[OJS 3.2.0.2] Are Files in Publisher Library Automatically Renamed?

Hej @asmecher,

will files, which are uploaded to the Publisher Library (Workflow Settings » Publisher Library » Other), be renamed automatically? All our files get a »-OTH« (for »Other«?) at the end of their name (in the corresponding »library« folder in »files« directory: /files/contexts/1/library/).
What’s exactly the idea behind this?

I’m asking, because up to OJS 3.1 we used a symlink, which points to the directory to shorten the URLs for the download files. But now that doesn’t seem to be an option any more, and we have to use the long URLs, which doesn’t even contain the file name (which would be nicer for SEO reasons), but the database ID.

Thanks,
Tobias

Hi @twa,

The library file storage was changed starting with OJS 3.2.0 to correct this bug: Submitting file to Submission Library overwrites Publisher Library files · Issue #5471 · pkp/pkp-lib · GitHub

The suffixes correspond to the library file type – Marketing, Permissions, Reports, or Other. (These are coded in lib/pkp/classes/file/PKPLibraryFileManager.inc.php.)

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks, @asmecher, for pointing this out. I see the point, but I would have preferred a sub directory structure to solve Submitting file to Submission Library overwrites Publisher Library files · Issue #5471 · pkp/pkp-lib · GitHub :

/library/marketing/
/library/permissions/
/library/reports/
/library/other/

This new behaviour leads to relinking of many library files in our system. Hm.

Besides that: Isn’t there a chance to provide shorter links for the library downloads? Ideally with showing real file names for better SEO results?
We have a need for short URLs regarding downloadable files, because some of the files are communicated over various channels (Twitter, other magazines etc.).

Thanks,
Tobias

Hi @twa,

I don’t think OJS ever generated links that went directly to the public files directory; I could be wrong, but I think all of its links to download library files went via the handler, and those URLs are unchanged with the move to the new naming convention. Longer term I’m hoping/planning to remove the public files directory entirely, as I think it’s a likely opportunity for an attack vector to open up at some point, and I’d like to eventually rearrange the application’s deployment based e.g. on the discussion at [OJS] Safety/security of OJS application structure · Issue #1832 · pkp/pkp-lib · GitHub.

As for assigning real file names for SEO purposes, off the top of my head I think you can add a /anyFilenameHere.pdf suffix to the file download URL and it’ll be ignored by OJS.

Thanks,
Alec Smecher
Public Knowledge Project Team

Hej @asmecher,

but how would you then give the opportunity to upload and use files? Couldn’t we introduce a PHP, which provides short URLs for some files, which automatically link to the correct URLs? Isn’t this possible? Then you could treat those files as you treat all other submission files internally.

Thanks,
Tobias

Hi @twa,

It looks like this does need some attention; by coincidence this was recently filed, pointing out that files can’t be updated without a change in URLs:

https://github.com/pkp/pkp-lib/issues/5780

I’ll add a note suggesting that a URL slug might be useful to help solve both issues.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Oh, yes, a file independent slug may serve this issue.