Closed Bug 1228264 Opened 10 years ago Closed 10 years ago

Incorrect ../ relative url resolution when using package url (!//)

Categories

(Core :: Networking: HTTP, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: kanru, Unassigned)

Details

I'm not sure if this is the correct component. For a package with URL like http://example.com/tests/example.pak!//index.html Assume in index.html we have a <img src="../test.png"> Currently that url is resolved to http://example.com/tests/example.pak!/test.png Which seems totally wrong to me. I'm not sure whether it should resolve to http://example.com/tests/test.png or http://example.com/test.png Note <img src="../../test.png"> curretly resolve to http://example.com/tests/test.png
I'm not sure if/how we would fix this without breaking webcompat. For example, if we have a folder called test, which contains index.html, I can access it http://localhost/test/index.html, or http://localhost/test//index.html (double slash). While they both load index.html, relative paths would be resolved differently, depending on the number of slashes. So this is not a packaged app issue. Moreover, this behaviour is found in other browsers as well, so I don't know if we should change it. As I see it, the best practices for packaged apps should be to only use relative paths for resources inside the package absolute paths otherwise.
Hmmm.. this is somewhat surprising to me. I thought that the "//" part would be treated like a single path. So I would have expected it to resolve to http://example.com/tests/test.png What do other browsers do? Does the spec [1] say anything? [1] https://url.spec.whatwg.org/
[1] and [2] seem to indicate that that the empty path segments are expected and parsed properly. The reason that //test is the same as /test is that operating systems treat // as /. See [3] [1] https://url.spec.whatwg.org/#url-serializing [2] https://url.spec.whatwg.org/#syntax-url-path-segment [3] http://stackoverflow.com/a/10161264
Ok, based on that I think we should just live with the current behavior. It sounds like it is consistent across browsers which means that it's unlikely to change.
Whiteboard: [necko-would-take]
Resolving per comment 4
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
Whiteboard: [necko-would-take]
You need to log in before you can comment on or make changes to this bug.