-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: decode media names before inserting into the database #18019
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2575,7 +2575,8 @@ class NoteEditor : | |
|
||
private fun updateField(field: FieldEditText?): Boolean { | ||
val fieldContent = field!!.text?.toString() ?: "" | ||
val correctedFieldContent = NoteService.convertToHtmlNewline(fieldContent, shouldReplaceNewlines()) | ||
// Decode the file name when preparing data for saveNote() to handle special characters correctly | ||
val correctedFieldContent = Uri.decode(NoteService.convertToHtmlNewline(fieldContent, shouldReplaceNewlines())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't this affect any kind of encoded content the user has added? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not aware of any instances where users would intentionally add encoded content, but this is something to consider. If necessary, we might need to ensure that only media filenames are decoded rather than applying decoding to all fields. Do you know of any cases where users might intentionally add encoded content? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From memory, no. But in Anki there are always someone doing stuff like that |
||
if (editorNote!!.values()[field.ord] != correctedFieldContent) { | ||
editorNote!!.values()[field.ord] = correctedFieldContent | ||
return true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
//
should follow the surrounding indent