Skip to content
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

apostrophe, double-quote, colon in file name of deposited file causes an error #40

Closed
photomedia opened this issue Feb 18, 2022 · 5 comments
Closed
Labels

Comments

@photomedia
Copy link
Collaborator

@photomedia photomedia commented Feb 18, 2022

Another instance of an error is if there's an apostrophe in the file name of a deposited file, then we get this:

  • [0] Copy - '/opt/eprints3/archives/library/documents/disk0/...l'Universite_Concordia.pdf'
    PROBLEM DETECTED WITH 6727 CANCELLING

To reproduce the error, upload a file with an apostrophe in the name, for example:
l'Universite_Concordia.pdf

We need to escape any apostrophes in the copy calls.

@photomedia photomedia added the bug label Feb 18, 2022
@photomedia
Copy link
Collaborator Author

@photomedia photomedia commented Feb 20, 2022

Investigating this further, testing with the file 'collectivités_traumatisé's.pdf'

the copy operation fails on this line:

my $ok = copy($local_path, "$file_path/$filename"); # or warn "Copy failed: $!";

The error is caught, but the details are not displayed, tracing the error, the details are actually:
Copy failed: No such file or directory*

It fails because the file is not found.

The file is not found because when I look at what is actually stored in that location on disk, it is this:
'collectivités_traumatisé=0027s.pdf'

So does EPrints substitute apostrophes in file names with "=0027" when it saves them to disk?

photomedia added a commit that referenced this issue Feb 21, 2022
regex to catch the apostrophe in filename transformation on disk
improved error handling to provide more details on the error in the log
@photomedia
Copy link
Collaborator Author

@photomedia photomedia commented Feb 21, 2022

added a regex to catch this transformation of filename on disk, and more details on the error log if/when copy operation fails again. this resolved the issue on my repository.

@photomedia
Copy link
Collaborator Author

@photomedia photomedia commented Feb 21, 2022

will include this fix in next release 1.2.3

@photomedia
Copy link
Collaborator Author

@photomedia photomedia commented Feb 25, 2022

The double-apostrophe causes the same failure.
To reproduce, deposit a file with this filename: As"ad.pdf
On disk, the " is replaced by =0022

@photomedia photomedia changed the title apostrophe in file name of deposited file causes an error apostrophe and double-quote in file name of deposited file causes an error Feb 25, 2022
@photomedia
Copy link
Collaborator Author

@photomedia photomedia commented Mar 9, 2022

Another special character that gets replaced, in addition to quote, double-quote, colon.
So we have this:
=003a
replacing any : in a filename.
Need to include that in the REGEX.

@photomedia photomedia changed the title apostrophe and double-quote in file name of deposited file causes an error apostrophe, double-quote, colon in file name of deposited file causes an error Mar 9, 2022
photomedia added a commit that referenced this issue Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant