Non-compatible replacement characters chosen when saving to NTFS while running on Linux / Docker
Describe the bug
I've migrated Libation from Windows to Docker but I'm still saving data to the same external disk. But whenever a downloaded library item has a colon in it, moving the decrypted file to its target destination fails. There is an existing file for that library item already on disk, but renaming that file does not solve the error.
I tried to set ReplacementCharacters in Settings.json, but it seems that is not taken into consideration. What should that setting look like in the file?
To Reproduce
Steps to reproduce the behavior:
- Configure Libation Docker on Linux to save files on NTFS disk
- Start download of library item with colons in the name or download library item in a series where Libation generates something like "Title: The Example Series, Book 1"
- See error in Docker output and log file in
config-internal
Expected behavior
The downloads should work and Libation should choose appropriate default replacement characters depending not just on the platform, but also the target destination file system capabilities?
Alternatively, could this be a dedicated configuration setting to choose from one of the replacement character sets directly?
Platform
latest Docker on Linux, coming from Windows 10.
Current Settings.json (no Books key as that is replaced when running on Docker):
{
"LogLevel_Verbose_Enabled": true,
"LogLevel_Debug_Enabled": true,
"FirstLaunch": false,
"ReplacementCharacters": {
"OtherInvalid": "_",
"FilenameForwardSlash": "∕",
"FilenameBackSlash": "",
"OpenQuote": "“",
"OtherQuote": """,
"OpenAngleBracket": "<",
"CloseAngleBracket": ">",
"Colon": "_",
"Asterisk": "✱",
"QuestionMark": "?",
"Pipe": "⏐"
},
"DownloadSpeedLimit": 2097152,
"ImportEpisodes": false,
"DownloadEpisodes": false,
"OverwriteExisting": true,
"Panel2Collapsed": true,
"hasMigratedToHighDPI": true,
"Form1": {
"X": 26,
"Y": 26,
"Height": 679,
"Width": 1494,
"IsMaximized": true
}
}
Log Files
Docker is not officially supported. I'm happy to leave this ticket open; other docker users sometimes browse these tickets.
Pinging @ducamagnifico , @wtanksleyjr , @CLHatch in case any of you have faced this and/or have ideas.
I'm quite confident that this will also happen if I try to use Libation Desktop on Linux when trying to write to an NTFS filesystem. I'll see if I can try that this week 👍
This whole illegal character business has been a nightmare from day 1. There's no way for us to know ahead of time which characters are restricted in a given path. I tried solving this "Once and For All" a while back by writing test files to the Books directory (see FileSystemTest). However, that system is only used if Libation is run on a non-windows machine. See below. https://github.com/rmcrackan/Libation/blob/d85e5a0f98ec4e537695aed39b33dcfa158e4558/Source/LibationAvalonia/Views/MainWindow.axaml.cs#L52-L62
I'm curious to know if Libation in a docker under windows thinks it's on a windows or Linux OS. Can you attach your log file?
This whole illegal character business has been a nightmare from day 1. There's no way for us to know ahead of time which characters are restricted in a given path. I tried solving this "Once and For All" a while back by writing test files to the Books directory (see FileSystemTest). However, that system is only used if Libation is run on a non-windows machine. See below.
Libation/Source/LibationAvalonia/Views/MainWindow.axaml.cs
Lines 52 to 62 in d85e5a0
private void Settings_PropertyChanged(object sender, Dinah.Core.PropertyChangedEventArgsEx e) { if (!Configuration.IsWindows) { //The books directory does not support filenames with windows' invalid characters. //Tell the ReplacementCharacters configuration to treat those characters as invalid. ReplacementCharacters.AdditionalInvalidFilenameCharacters = Configuration.Instance.BooksCanWriteWindowsInvalidChars ? [] : FileSystemTest.AdditionalInvalidWindowsFilenameCharacters.ToArray(); } } I'm curious to know if Libation in a docker under windows thinks it's on a windows or Linux OS. Can you attach your log file?
I would think the "once and for all" fix would be to not try to determine what characters are invalid, and just always use the replacement list the user sets.
@CLHatch We try to do both. There's an All other invalid characters replacement that only works if Libation can actually determine that a character is invalid.
But any character in the replacements list will be replaced regardless of its legality in a file name/path. (case sensitive).
I just tested this again to make sure it's true. I downloaded the book The Snowy Day, and it saved to:
C:\Users\mbuca\Music\Libation\Books\The Snowy Day [B002V0KCZU]\The Snowy Day [B002V0KCZU].m4b
I then added the letter 'o' to my replacement list, to be replaced with 'p'. I re-downloaded The Snowy Day, and it saved to:
C:\Users\mbuca\Music\Libatipn\Bppks\The Snpwy Day [B002V0KCZU]\The Snpwy Day [B002V0KCZU].m4b
This whole illegal character business has been a nightmare from day 1. There's no way for us to know ahead of time which characters are restricted in a given path. I tried solving this "Once and For All" a while back by writing test files to the Books directory (see FileSystemTest). However, that system is only used if Libation is run on a non-windows machine. See below.
Libation/Source/LibationAvalonia/Views/MainWindow.axaml.cs
Lines 52 to 62 in d85e5a0 private void Settings_PropertyChanged(object sender, Dinah.Core.PropertyChangedEventArgsEx e) { if (!Configuration.IsWindows) { //The books directory does not support filenames with windows' invalid characters. //Tell the ReplacementCharacters configuration to treat those characters as invalid. ReplacementCharacters.AdditionalInvalidFilenameCharacters = Configuration.Instance.BooksCanWriteWindowsInvalidChars ? [] : FileSystemTest.AdditionalInvalidWindowsFilenameCharacters.ToArray(); } }
I'm curious to know if Libation in a docker under windows thinks it's on a windows or Linux OS. Can you attach your log file?
@Mbucari The log file for Libation in Docker is attached in the initial post and here is the relevant part if I saw that correctly:
{"Platform":"Unix","ServicePack":"","Version":{"Major":6,"Minor":16,"Build":10,"Revision":1,"MajorRevision":0,"MinorRevision":1,"$type":"Version"},"VersionString":"Unix 6.16.10.1","$type":"OperatingSystem"}