diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ae9cf0520..612b0c336 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -197,14 +197,14 @@ jobs: uses: actions/cache@v1 with: path: ${{ matrix.CARGO_INDEX_DIR }} - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-22- + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-23- - name: Cache cargo registry if: matrix.python == '3.7' uses: actions/cache@v1 with: path: ${{ matrix.CARGO_REGISTRY_DIR }} - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-22- + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-23- - name: Cache cargo target if: matrix.python == '3.7' @@ -218,7 +218,7 @@ jobs: uses: actions/cache@v1 with: path: ${{ github.workspace }}${{ matrix.SEP }}rslib${{ matrix.SEP }}target - key: ${{ runner.os }}-cargo-rslib-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-22- + key: ${{ runner.os }}-cargo-rslib-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-23- - name: Cache cargo rspy if: matrix.python == '3.7' diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 083f0fd9d..4b79d7897 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -388,12 +388,9 @@ class Editor: if nid != self.note.id: print("ignored late blur") return - txt = self.mungeHTML(txt) - # misbehaving apps may include a null byte in the text - txt = txt.replace("\x00", "") - # reverse the url quoting we added to get images to display - txt = self.mw.col.media.escapeImages(txt, unescape=True) - self.note.fields[ord] = txt + + self.note.fields[ord] = self.mungeHTML(txt) + if not self.addMode: self.note.flush() self.mw.requireReset() @@ -1203,5 +1200,17 @@ def munge_html(txt, editor): return "" if txt in ("
", "

") else txt +def remove_null_bytes(txt, editor): + # misbehaving apps may include a null byte in the text + return txt.replace("\x00", "") + + +def reverse_url_quoting(txt, editor): + # reverse the url quoting we added to get images to display + return editor.mw.col.media.escapeImages(txt, unescape=True) + + gui_hooks.editor_will_use_font_for_field.append(fontMungeHack) gui_hooks.editor_will_munge_html.append(munge_html) +gui_hooks.editor_will_munge_html.append(remove_null_bytes) +gui_hooks.editor_will_munge_html.append(reverse_url_quoting)