meeb / django-distill

Minimal configuration static site generator for Django
MIT License
441 stars 35 forks source link

Google Backend Remote path on windows #41

Closed JJMeijer closed 3 years ago

JJMeijer commented 3 years ago

Hi, I'm using django-distill with the Google storage backend on windows. When uploading a file the remote path for the file becomes path\\to\\index.html. However Google storage interprets that literally and does not convert the windows path format. So the URL for the uploaded file becomes https://storage.googleapis.com/bucket/path%5Cto%5Cindex.html instead of the https://storage.googleapis.com/bucket/path/to/index.html that you would expect.

Would it be possible to convert the windows-style path format to the right url format before initiating the upload?

meeb commented 3 years ago

Ignore last comment, replied from the wrong project entirely (I'm a little short on sleep lately...).

I'll take a look at this, I may have missed an updated flag on some API call somewhere to preserve the path for this backend on Windows.

meeb commented 3 years ago

Interesting, the Google Clould Files API docs say they handle both \ and / as directory separators, however I'll push a small patch to replace \ with / anyway in remote paths when uploading with the bundled Google storage backend anyway.

meeb commented 3 years ago

This is in the just pushed 2.7 version if django-distill - please update and see if this fixes your issue. I don't actually have a Windows machine on hand (or a Google account!) to test this so I've just taken an educated guess to fix it.

JJMeijer commented 3 years ago

Fixed! Thank you and take care!

meeb commented 3 years ago

No problem, cheers!