rwthmoodle / Sync-my-L2P

DOWNLOAD HERE: https://github.com/rwthmoodle/Sync-my-L2P/releases/latest
http://www.syncmyl2p.de/
GNU Lesser General Public License v3.0
27 stars 6 forks source link

Cannot download file #3

Closed HarHarLinks closed 3 years ago

HarHarLinks commented 3 years ago

Describe the bug

ERROR 10:42:33.217 Directory not createable. :  Can not create the following directory: ss21/Funktionale Programmierung (VO) [12.53698]/Legal Notes on the Use of Zoom/CLS-Step-by-Step Guide for participants using zoom (EN) (PDF; Upload 02.03./ 

I'm not sure what is happening, since the file doesn't contain / on moodle: image

See also my report on the former repo: RobertKrajewski/Sync-my-L2P#168

To Reproduce Sync https://moodle.rwth-aachen.de/course/view.php?id=14064 (Funktionale Programmierung (VO) [12.53698] SS21)

Expected behavior Sync...

Desktop (please complete the following information):

t-schroeder commented 3 years ago

I've tried to reproduce this on Arch Linux but couldn't. Do you still experience this bug?

The / is just the path separator, not part of any folder or file name. Sync-my-L2P shortens folder names if they get over a certain number of characters. I guess that's what's happening here.

HarHarLinks commented 3 years ago

Then I agree this is happening here. I tracked the problem down further:

$ mkdir -v "ss21/Funktionale Programmierung (VO) [12.53698]/Legal Notes on the Use of Zoom/CLS-Step-by-Step Guide for participants using zoom (EN) (PDF; Upload 02.03."
mkdir: cannot create directory ‘ss21/Funktionale Programmierung (VO) [12.53698]/Legal Notes on the Use of Zoom/CLS-Step-by-Step Guide for participants using zoom (EN) (PDF; Upload 02.03.’: Invalid argument

$ mkdir -v "ss21/Funktionale Programmierung (VO) [12.53698]/Legal Notes on the Use of Zoom/CLS-Step-by-Step Guide for participants using zoom (EN) (PDF; Upload 02.03"
mkdir: created directory 'ss21/Funktionale Programmierung (VO) [12.53698]/Legal Notes on the Use of Zoom/CLS-Step-by-Step Guide for participants using zoom (EN) (PDF; Upload 02.03'

hint: try an ntfs filesystem. not only will it be common by the omnipresence of windows, but the uni requires using it often enough.

please make SML2P check for validity of paths when modifying (actually, better to always do it). particularly a directory ending in . seems not allowed in this case.

t-schroeder commented 3 years ago

I see. I had noticed a similar problem on Windows: When you create a folder ending in one or more dots it creates a folder without those trailing dots in the name. So mkdir a... creates the folder a which then lead to errors when you wanted to write to a...\file.txt. Since other OSs didn't seem to have this problem I cut the dots from the end of folder names only on Windows (057f140451b747b99bf231d985f07b8ad2abb178).

The hint about NTFS did help me to reproduce this. While a partition using ntfs-3g (created with mkfs.ntfs) doesn't have this problem, an NTFS filesystem created by Windows and then mounted in Linux does.

t-schroeder commented 3 years ago

There's many possible file/folder name restrictions if you check the Boost.Filesystem recommendations. I've checked on recent versions of Windows, Linux and macOS and the only still relevant restrictions seem to be:

We already check if the total path length is exceeded on Windows. So I just extended the rule that cuts all trailing dots off of folder names from Windows to all platforms (57df296fefd19a03acc87d49ee914ca05c11a1a5) and created a new release with this fix. Case insensitivity is not a problem unless you have files, folders, topics, courses that only differ by their capitalization.

Trying to create the folder is the validity check: https://github.com/rwthmoodle/Sync-my-L2P/blob/57df296fefd19a03acc87d49ee914ca05c11a1a5/src/browser.cpp#L193-L199 But all that does is tell us whether the folder could be created or not. It doesn't tell us why it couldn't be created. It doesn't tell us how we should change the folder name to make it creatable. We have to implement this logic ourselves. And the simplest solution seems to me to just cut all dots off the end of folder names.

HarHarLinks commented 3 years ago

thanks, seems to finally have resolved my issue