Problems with url-encoded html galley image paths in OJS3

Hi,
We have a bunch of html galleys with url-encoded image paths, specifically spaces have been replaced with %20. In OJS 2 these were understood by the system and replaced with OJS paths, i.e. article/viewFile/xxx/yyy/zzz and the correct files were shown, but in OJS 3 they are not recognized and the galleys keep the original filenames from the upload, i.e. src="file:///some/path/figure%201.jpg". The DB entry in the submission files table has the filename figure 1.jpg (without %20).

If I edit the galley on the server and replace the %20 with a space, it works again. We could easily script a fix for replacing all %20s. Is there anything else we can/should do, or was it just a lucky coincidence that it worked at all in OJS2?

Simon

Hi @simonmitternacht,

Hmm, that sounds like a regression to me. Can you find the line in plugins/generic/htmlArticleGalley/HtmlArticleGalleyPlugin.inc.php, around line 135, that reads…

$pattern = preg_quote($embeddableFile->getOriginalFileName());

…and change it to the following?

$pattern = preg_quote(rawurlencode($embeddableFile->getOriginalFileName()));

Let me know if that resolves the issue without needing any database filename changes etc.

If that works, I’ll commit it to the codebase for the next release.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,
That worked! The paths that I “fixed” don’t work anymore, but I assume that’s not a problem.

Thanks!

Simon

Hi @simonmitternacht,

Great, thanks – merged for the next release: HTML image URLs with special characters do not work · Issue #3996 · pkp/pkp-lib · GitHub

Regards,
Alec Smecher
Public Knowledge Project Team

im also having this problem, we migrated to a different server and this started showing up, it was ok before