Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility issue on Windows #167

Merged
merged 2 commits into from
Dec 15, 2023

Conversation

zhaoblake
Copy link

@zhaoblake zhaoblake commented Dec 1, 2023

Fix compatibility issue when converting a Windows path to a URL.

On Windows, the output of the following code is ['/static/foo%5Cbar'], which works fine on Linux as ['/static/foo/bar']. The issue arises from the difference between Windows' path separator (\\) and the URL separator (/), well on Linux, path separator is same as the URL separator.

from flask import Flask
from flask_assets import Environment, Bundle

app = Flask(__name__)
env = Environment(app)
print(Bundle("foo/bar", env=env).urls())  

@greyli
Copy link
Collaborator

greyli commented Dec 14, 2023

Could you add some tests for this fix?

@zhaoblake
Copy link
Author

Could you add some tests for this fix?

Actually there is already a test related to this, it failed on Windows Platform due to this compatibility issue. I think it is not necessary to add a new one.

@greyli greyli merged commit 62efd23 into miracle2k:master Dec 15, 2023
15 checks passed
@greyli
Copy link
Collaborator

greyli commented Dec 15, 2023

I see. I just enabled the CI for Windows.

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants