romm icon indicating copy to clipboard operation
romm copied to clipboard

[Bug] Rename function struggles with special characters

Open Casuallynoted opened this issue 1 year ago • 13 comments

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.

Casuallynoted avatar Oct 05 '23 00:10 Casuallynoted

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.

gantoine avatar Oct 07 '23 20:10 gantoine

I'm using a ZFS machine at the moment

Casuallynoted avatar Oct 07 '23 20:10 Casuallynoted

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

Ultraguy24 avatar Nov 07 '23 15:11 Ultraguy24

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.

Ultraguy24 avatar Nov 15 '23 15:11 Ultraguy24

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.

Ultraguy24 avatar Nov 15 '23 15:11 Ultraguy24

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.

Nomelas avatar Jan 04 '24 20:01 Nomelas

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.

annihilatethee avatar Feb 26 '24 19:02 annihilatethee

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.

BACONGUDEN avatar Jun 23 '24 12:06 BACONGUDEN

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).

gantoine avatar Jun 23 '24 16:06 gantoine

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.

BACONGUDEN avatar Jun 23 '24 17:06 BACONGUDEN

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.

Nomelas avatar Jun 23 '24 18:06 Nomelas

I also run on Linux and experience this issue.

Casuallynoted avatar Jun 23 '24 19:06 Casuallynoted

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

gantoine avatar Jun 23 '24 19:06 gantoine

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.

vodkapmp avatar Aug 20 '24 02:08 vodkapmp

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

gantoine avatar Aug 29 '24 20:08 gantoine

Confirmed fixed in 3.5!

Nomelas avatar Sep 04 '24 00:09 Nomelas