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

Cleanup Entries -> Rename PDFs Doesn't Preserve Key Case #466

Closed
jkulesza opened this issue Dec 5, 2015 · 5 comments
Closed

Cleanup Entries -> Rename PDFs Doesn't Preserve Key Case #466

jkulesza opened this issue Dec 5, 2015 · 5 comments

Comments

@jkulesza
Copy link

jkulesza commented Dec 5, 2015

If the filename of a linked PDF is converted to lowercase outside of JabRef, when JabRef runs a Cleanup -> Rename PDFs, it does not rename/move the file back to "proper" upper/lower case consistent with its associated key.

For example, a file with key Article_2015_NT_Woolley_191--207 will not be renamed to Article_2015_NT_Woolley_191--207.pdf from article_2015_nt_woolley_191--207.pdf.

@simonharrer simonharrer added the bug Confirmed bugs or reports that are very likely to be bugs label Dec 5, 2015
@oscargus
Copy link
Contributor

oscargus commented Dec 5, 2015

Just checking (I have no idea how the code works, but I browsed it at least): what operating system do you run? Does JabRef show a dialog "File rename failed for XX entries?"?

@jkulesza
Copy link
Author

jkulesza commented Dec 5, 2015

@oscargus Thanks for looking into this. I'm running two versions of OSX (10.9.5/Mavericks and 10.11/El Capitan) and both exhibit this problem.

JabRef does not show a dialog. However, the status bar shows "Status: No entry needed a cleanup".

However, if I rename the file from "article_2015_nt_woolley_191--207.pdf" to "arrticle_2015_nt_woolley_191--207.pdf" and then update the filename in JabRef, it will rename the file, with proper capitalization, to the key.

Having not looking at it (I've never worked in Java), I'm guessing that it's doing a case-insensitive query on the filetype to see if it agrees with the key, if so, it finds "nothing to update". If there is a mismatch in the content, not the case, it will update both content and case. If this is true, hopefully making that case-insensitive query to be case-sensitive will not be a large change.

@oscargus
Copy link
Contributor

oscargus commented Dec 5, 2015

I've checked the code further now and the main suspect is a call to File.exists(), which depending on the file system may or may not consider the case.

Do you know if your file system is case sensitive or case insensitive?

I think you partly can tell the answer of the above question based on if the problem is "only" cosmetic or if it actually prevents you from opening the file from JabRef. (With the reservation that opening files may use other methods which breaks my assumption.)

@jkulesza
Copy link
Author

jkulesza commented Dec 5, 2015

As far as I know, OSX should be case sensitive (being Unix-based). When I navigate in the Terminal, it is most definitely case sensitive.

To your point, this issue is "only" cosmetic in that JabRef can still open the file.

However, I fear that this can cause issues when working between platforms (e.g., when I access the files using JabRef on Linux). Also, it is inconsistent with the purpose of the "clean up" command.

As I indicated, I'm not a Java developer; however, I wonder if the getCanonicalPath() and getCanonicalFile() functions might address the issue...?

@oscargus
Copy link
Contributor

oscargus commented Dec 5, 2015

OK! I've seen those commands in the threads as well, but it's not clear (to me at least) where they would be useful in the current implementation. It seems like there are some issues in this regard with OSX as the Java API is not always consistent with the file system, but I thought it was primarily the other way around.

I agree with you though that ideally it should work the way that you want. Especially from the Linux aspect. A most likely feasible work-around is to do the cleanup on Linux, then it would probably work as expected.

I can confirm that it works the same way on Windows anyway.

The "problem" is somehow that currently the implementation (appears to) builds on the standard API with well defined calls, while solving this would require "hacks" as I understand it. But it is probably worth solving.

@oscargus oscargus removed the os: macOS label Dec 5, 2015
@lenhard lenhard changed the title [Bug] Cleanup Entries -> Rename PDFs Doesn't Preserve Key Case Cleanup Entries -> Rename PDFs Doesn't Preserve Key Case Dec 6, 2015
@lenhard lenhard added type: enhancement and removed bug Confirmed bugs or reports that are very likely to be bugs labels Jan 25, 2016
tobiasdiez added a commit that referenced this issue Feb 28, 2016
Fix #466: Rename PDF cleanup now also changes case of file name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants