asset_url_for is checking for '//' in the asset, might be too general

#24 · closed · 2 comments

View on GitHub ↗

SaraiDuek

Then i'm trying to add an asset in the html with an asset key from the manifest that has '//' in it: ``` <link rel="shortcut icon" type="image/x-icon" href="{{ asset_url_for('.//favicon.png') }}" /> ``` This makes the asset_url_for tag from flask_webpack not work (script and style tags are working great) because of this if in the asset_url_for function (line 123 in [flask_webpack/__init__.py](https://github.com/nickjj/flask-webpack/blob/master/flask_webpack/__init__.py)): ``` if '//' in asset: return asset ``` might be worth it to be more specific in that if and include 'http' exp instead to make the if better serve its purpose. (i'd be happy to submit a pr for this if acceptable)

Comments

nickjj

Hi, It can't be `http` because `//` is a valid protocol too. I'm not sure if it really needs a PR because under normal circumstances you would never have an asset path of `.//favicon.png`, and the only reason you need to do this now is because of a bug in the manifest plugin.

SaraiDuek

Ah ok this is what i thought (about the bug). And thanks for the explanation on the http :) 2018-01-31 23:20 GMT+02:00 Nick Janetakis <[email protected]>: > Hi, > > It can't be http because // is a valid protocol too. > > I'm not sure if it really needs a PR because under normal circumstances > you would never have an asset path of .//favicon.png, and the only reason > you need to do this now is because of a bug in the manifest plugin. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/nickjj/flask-webpack/issues/24#issuecomment-362074347>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AHY62JzkCbb9NgupOKyGCsDV4k2-CsYIks5tQNkWgaJpZM4R0qVR> > . >