View Issue Details

IDProjectCategoryView StatusLast Update
0004833Talermerchant frontend (blog)public2017-06-06 14:18
ReporterMarcello StanisciAssigned ToMarcello Stanisci 
PriorityhighSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionSVN HEAD 
Target Version0.3Fixed in Version0.3 
Summary0004833: url() breaks JS version
DescriptionThe JS version of the blog uses this jinja filter 'url("static/.../")'.

When trying to buy articles, this resolves to "/essay/static/...", that
does not exist, so it breaks the payment because taler-wallet-lib cannot
be found.

Fortunately, the JS-free version seems to not suffer from this.
TagsNo tags attached.

Activities

Marcello Stanisci

2016-12-07 11:31

manager   ~0011572

Shall we get rid of url() and resume the hardcoded way?

Florian Dold

2016-12-07 12:32

manager   ~0011573

I don't see why we can't fix this if the JavaScript-free version works correctly. In this case, it looks like we should just use an application-root relative URL in the src tag for the taler-wallet-lib script.


We can't simply hardcode everything, because we cannot make the assumption that the front end is mounted under "/".

Marcello Stanisci

2016-12-07 14:08

manager   ~0011574

Yes, we can, I never said we can't :)

Anyway it seems hard to find documentation about this 'url()' helper function
you use in templates: who provides it, Jinja? Flask?

Florian Dold

2016-12-07 14:26

manager   ~0011576

It's defined here: https://git.taler.net/merchant-frontends.git/tree/talerfrontends/blog/blog.py#n55

We provide it for Jinja through Flask's API. If you need to change it, feel free to do so or ask me to add something.

Marcello Stanisci

2016-12-07 17:34

manager   ~0011577

The way url() works looks fine. The problem is that the browser then appends
that relative URL to one having this "../essay/.." in the middle, and that corrupts things.
That seems unfixable if url() doesn't return an absolute URL ...

Florian Dold

2016-12-07 17:38

manager   ~0011578

We can make it return a URL absolute to the host, by starting it with a slash.

When your browser is at https://example.com/foo/bar, and you click a link to to "spam", you'll end up with https://example.com/foo/bar/spam. But if you navigate to "/spam", then you'll end up at https://example.com/spam.

We just have to make the url helper return a host-relative (not path-relative) URL that respects the application's root.

Marcello Stanisci

2016-12-07 20:52

manager   ~0011579

Just prepending a slash fixed it. 1a84981

Issue History

Date Modified Username Field Change
2016-12-07 11:29 Marcello Stanisci New Issue
2016-12-07 11:30 Marcello Stanisci Priority normal => high
2016-12-07 11:31 Marcello Stanisci Note Added: 0011572
2016-12-07 12:32 Florian Dold Note Added: 0011573
2016-12-07 14:08 Marcello Stanisci Note Added: 0011574
2016-12-07 14:26 Florian Dold Note Added: 0011576
2016-12-07 17:34 Marcello Stanisci Note Added: 0011577
2016-12-07 17:38 Florian Dold Note Added: 0011578
2016-12-07 18:01 Marcello Stanisci Assigned To => Marcello Stanisci
2016-12-07 18:01 Marcello Stanisci Status new => assigned
2016-12-07 20:52 Marcello Stanisci Note Added: 0011579
2016-12-07 20:52 Marcello Stanisci Status assigned => resolved
2016-12-07 20:52 Marcello Stanisci Resolution open => fixed
2017-01-16 10:22 Christian Grothoff Product Version => SVN HEAD
2017-01-16 10:22 Christian Grothoff Fixed in Version => 0.3
2017-01-16 10:22 Christian Grothoff Target Version => 0.3
2017-06-06 14:18 Christian Grothoff Status resolved => closed