瀏覽代碼

Python 3 issue with re

Python 3 interprets string literals as Unicode strings, and therefore \s is treated as an escaped Unicode character.

Declare RegEx pattern as a raw string instead by prepending r
version-14
Joseph Marie Alba 4 年之前
committed by GitHub
父節點
當前提交
62d81b7610
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      frappe/utils/file_manager.py

+ 1
- 1
frappe/utils/file_manager.py 查看文件

@@ -418,7 +418,7 @@ def extract_images_from_html(doc, content):
return '<img src="{file_url}"'.format(file_url=file_url)

if content:
content = re.sub('<img[^>]*src\s*=\s*["\'](?=data:)(.*?)["\']', _save_file, content)
content = re.sub(r'<img[^>]*src\s*=\s*["\'](?=data:)(.*?)["\']', _save_file, content)

return content



Loading…
取消
儲存