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

Bug where if base = "" it would incorrectly create a leading / #21 #29

Merged
merged 1 commit into from
Oct 16, 2017

Conversation

mdedetrich
Copy link
Contributor

@mdedetrich mdedetrich commented Oct 15, 2017

This fixes #21

Basically what happened is that if the base path was "" (which meant it was in the root of the folder), sbt-digest would create a path with a leading /. This means that physically on the file system the digest'ed file would be placed in the exact same location however the META-INF generated in the jar would have an incorrect entry with a double /, i.e. // which would affect resource lookups.

This means if you physically unzipped the jar the paths would line up fine however looking up resources (using getClass.getResourceAsStream or other variants) would fail unless you put a double //,

i.e. assuming you have WebKeys.packagePrefix in Assets := "public/"

printResourceAsStream("/public/8582ad69409ecf661cc901a281d8a30c-client-fastopt.js")

Would fail however

printResourceAsStream("/public//8582ad69409ecf661cc901a281d8a30c-client-fastopt.js")

Would succeed (notice the extra / after public)

This bug most likely was never noticed in Play because Play happens to place its assets in folders and doesn't put any assets in the root folder to get digested, however if you used sbt-digest manually and you digested assets in the root folder then you would get the error (as evidenced in https://github.com/mdedetrich/akka-http-with-scalajs-digest-issue)

@jroper Can you let me know when you merge + release this?

@jroper jroper merged commit 30ba638 into sbt:master Oct 16, 2017
@mdedetrich mdedetrich deleted the fixBugWithEmptyBase branch October 16, 2017 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mappings start with / which breaks things
2 participants