rommapp / romm

A beautiful, powerful, self-hosted rom manager
https://romm.app
GNU Affero General Public License v3.0
1.87k stars 86 forks source link

[Bug] Rename function struggles with special characters #392

Closed Casuallynoted closed 1 month ago

Casuallynoted commented 11 months ago

I've noticed that sometimes the rename file function leaves the roms with really weird names in the file explorer. In this example, the PC game Babylon 5: Into the Fire has been renamed to BDY6C8~Q.ZIP

But what's weird is that the game still downloads in Romm and shows in the Romm editor as having the proper name.

I think this happens when I go to have it rename a game that has a character like : in the title, and I believe the reason is because my filesystem may not like : in file names. I've tried renaming these games manually via my server's SMB connection and it always errors out when a : is included in the name.

gantoine commented 11 months ago

Alight finally back home and I can look into this. Which file system are you using? FWIW it works fine on macos journaled and ubuntu ext4.

Casuallynoted commented 11 months ago

I'm using a ZFS machine at the moment

Alucardac1 commented 10 months ago

So my current setup is having romM run via docker on Ubuntu ext4, I've noticed that if I use my Arch PC it renames correctly, however if I repeat the process from my Windows 10 Laptop, it ends up jumbled, likely due to colon being a invalid filename character on Windows systems. (ref: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions)

It might be a better idea to adjust the renaming script to convert these characters to spaces or hyphens to avoid compatibility issues. I hear the same issues are being caused by slashes in names.

Edit: After some research it appears the having Samba shares on the library directory can cause names to be mangled as well due to limitations. so the idea to replace the certain special characters will be a good shout.

I'm not sure if that will also require changing the scanning script to also replace these characters when detecting rom files by name (e.g. the script is looking for 'Bionicle: The Game' on IGDB, it should instead look for 'Bionicle - The Game.gba' instead of looking for 'Bionicle: The Game.gba') ref: https://wiki.samba.org/index.php/SMB3-Linux#:~:text=including%20case%20sensitivity.-,No%20reserved%20path%20characters,-Mapping%207%20reserved

Edit 2: Added reference pages

Alucardac1 commented 10 months ago

After some further testing, If I disable smb on the server and only view the renamed files on my storage server (Ubuntu 23) where I host my roms, I no longer get truncated filenames if they contain cited characters.

Alucardac1 commented 10 months ago

Just to clarify, I can see newly renamed files untruncated, while anything I renamed while smb was enabled still had the truncated name, unless I re-run the rename option from RomM.

Nomelas commented 8 months ago

I am also experiencing this. I am on Unraid using the official docker image, and here's another example (genesis game): Castlevania: Bloodlines

renames to: CKMXO9~5.GEN

To add, it looks like even the /romm/resources directory names for the paths containing covers/screenshots is named this: CKMXO9~5

Rather than the real name.

annihilatethee commented 7 months ago

Windows definitely does not allow colons in names. I'm seeing the same with the following.

Legend of Zelda: Breath of the Wild Legend of Zelda: Tears of the Kingdom Mario Golf: Super Rush Mario Striker: Battle League Pokemon Legends: Arceus

Would love to see a rename that disregards colons.

BACONGUDEN commented 3 months ago

Windows definitely does not allow colons in names. I'm seeing the same with the following. Would love to see a rename that disregards colons.

Seconding this, just had a panic attack thinking half of my roms just disappeared, turns out they were just renamed with colons in the file names.

It's also just ethical programming to not have special characters in file names to begin with.

gantoine commented 3 months ago

It's also just ethical programming to not have special characters in file names to begin with.

To be fair, we don't typically use special characters in any files we create; this is a side-effect of users running RomM under Windows, which we didn't expect and don't recommend. We do cleanup file names which are invalid on most common linux filesystems (and macos for development).

BACONGUDEN commented 3 months ago

I am running RomM in a docker container on debian personally, but I also access the library using my Windows computer using NFS. I'm not sure if I am misunderstanding you but the special symbols issue happens on Linux as well.

Many users do it this way (hosting on linux but accessing library also on windows), which is why this "sanitize file name"-check should be added.

Nomelas commented 3 months ago

It's also just ethical programming to not have special characters in file names to begin with.

To be fair, we don't typically use special characters in any files we create; this is a side-effect of users running RomM under Windows, which we didn't expect and don't recommend. We do cleanup file names which are invalid on most common linux filesystems (and macos for development).

As many pointed out, it's not isolated to running romm in Windows since most of us don't, and are experiencing this.

Running an SMB file share on a linux server for Windows access is very typical.

Casuallynoted commented 3 months ago

I also run on Linux and experience this issue.

gantoine commented 3 months ago

Well received, I'm going to increase the priority of this so we can start working on a fix sooner. 🫡

vodkapmp commented 1 month ago

It's also just ethical programming to not have special characters in file names to begin with.

To be fair, we don't typically use special characters in any files we create; this is a side-effect of users running RomM under Windows, which we didn't expect and don't recommend. We do cleanup file names which are invalid on most common linux filesystems (and macos for development).

image The rename function when matching unmatched roms will use any character it wants, even a /. I don't think my filesystem would've liked this one. Quite fun, I've seen it try and use just about every "illegal" character at this point while working on matching my entire PS1 collection.

gantoine commented 1 month ago

Wowza, long time coming but this will finally be fixed in the next release! Checkout #1109 if you want to see what changed.

Nomelas commented 3 weeks ago

Confirmed fixed in 3.5!