AlexCSDev / PatreonDownloader

Powerful tool for downloading content posted by creators on patreon.com. Supports content hosted on patreon itself as well as external sites (additional plugins might be required).
MIT License
979 stars 98 forks source link

Could not find a part of the path... #106

Closed shinji257 closed 1 year ago

shinji257 commented 2 years ago

Seems that it fails to download if part of the path ends with a space. This happens randomly at the start when I use the --json option. I worked around this by defining a download location however if the post itself has no title then it also fails in that case as well. Here is an example:

https://www.patreon.com/posts/13404620

2022-02-11 12:09:08.8478 ERROR Failed to download https://c10.patreonusercontent.com/4/patreon-media/p/post/13404620/b98a999fe56d4d9382e88fe57d8a1da2/eyJwIjoxfQ%3D%3D/1.jpg?token-time=1645833600&token-hash=01Zp_kXURHMujWCOaPqmiHkvPFQJTlER1zqO5GYm5I0%3D: Error while downloading https://c10.patreonusercontent.com/4/patreon-media/p/post/13404620/b98a999fe56d4d9382e88fe57d8a1da2/eyJwIjoxfQ%3D%3D/1.jpg?token-time=1645833600&token-hash=01Zp_kXURHMujWCOaPqmiHkvPFQJTlER1zqO5GYm5I0%3D: Unable to download from https://c10.patreonusercontent.com/4/patreon-media/p/post/13404620/b98a999fe56d4d9382e88fe57d8a1da2/eyJwIjoxfQ%3D%3D/1.jpg?token-time=1645833600&token-hash=01Zp_kXURHMujWCOaPqmiHkvPFQJTlER1zqO5GYm5I0%3D: Could not find a part of the path 'Z:\PatreonDownloader\FoxyArt\[13404620] 2017-07-26 \post_11_noviembre.jpg'.. Inner Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'Z:\PatreonDownloader\FoxyArt\[13404620] 2017-07-26 \post_11_noviembre.jpg'.
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at UniversalDownloaderPlatform.DefaultImplementations.WebDownloader.DownloadFileInternal(String url, String path, Boolean overwrite, Int32 retry, Int32 retryTooManyRequests) in F:\Sources\BigProjects\PatreonDownloader\submodules\UniversalDownloaderPlatform\UniversalDownloaderPlatform.DefaultImplementations\WebDownloader.cs:line 253
shinji257 commented 2 years ago

Oddly enough looking over the code this function should prevent this scenario

https://github.com/AlexCSDev/PatreonDownloader/blob/6516f73fdc2a06d6b2b96bab01cc879305931124/PatreonDownloader.Implementation/Helpers/PostSubdirectoryHelper.cs

AlexCSDev commented 1 year ago

I think this should be fixed in latest build, feel free to reopen if it's not.