Repository navigation
fix(editor): accept http(s) addresses for linked images - #421
Merged
Merged
Conversation
The image dialog only accepted an address when a word character followed the scheme's colon, so every http:// and https:// address was marked invalid and the dialog could not be confirmed. Accept addresses starting with http://, https:// or data:. Fixes #178 Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 task done
Member
Author
|
Correction to the description: images from other servers are not blocked. The editor iframe's Content Security Policy allows images from any origin ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #178
The "Linked image" dialog never accepted an address: the field stayed red and OK did nothing. The vendored editor checks the address with
/^(http|https|data)?\:\w+/, which needs a word character right after the colon, so everyhttp://andhttps://address failed. It now accepts addresses that start withhttp://,https://ordata:(/^(https?:\/\/|data:)\S+/). The only change is that regex invendor/kityminder-editor/kityminder.editor.min.js.Images from other servers still won't display, because the editor's Content Security Policy only allows images from the Nextcloud server itself and fromThis is wrong, see the correction. Image URLs on the same Nextcloud server and uploaded images (which aredata:URLs. Allowing outside images is a privacy decision, so it is not part of this PR.data:URLs) work.Tested: checked the new regex against
https://…,http://…anddata:image/png;base64,…(accepted) and againstftp://…,javascript:…,https://and an empty string (rejected). I have not yet tested the dialog in a running Nextcloud.A backport to
stable-0.1follows.🤖 AI (if applicable)