Skip to content

Conversation

@julien-nc
Copy link
Member

To reproduce the issue (and check it works fine this fix 😁):

  • create a new markdown document and open it
  • upload the same image twice so the second one is named image (2).png
  • close the document
  • check if image (2).png has been deleted in the attachment folder

The regex we were using did not match file names with parenthesis. The code is now a bit more complex but I couldn't find a way to make it work with one big single regex. So it first gets all the link targets and then filter to keep the text://image?imageFileName=blabla.png ones.

This should be backported to stable24 as it fixes #2338 .

…en there are parenthesis in the file names

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
@julien-nc
Copy link
Member Author

I forgot to mention the limitations of this regex: If the nested parenthesis are not coherent, this might not work.

By the way, I discovered that Php's urlencode() actually encodes parenthesis but Javascript's encodeURIComponent() does not.

If we manage to encode the parenthesis when generating the file name to be embedded in the MD content, we can stick with the old cleanup process. To be continued.

@mejo-
Copy link
Member

mejo- commented May 13, 2022

Thanks a lot @eneiluj for fixing this in #2383 <3

So this one can be closed then, right?

@julien-nc
Copy link
Member Author

Thank you for spotting the issue in the first place.

Yep yep closing...now.

@julien-nc julien-nc closed this May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't prepend timestamp to image filename

3 participants