Bug where if base = "" it would incorrectly create a leading / #21 #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theMETA-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
/
afterpublic
)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?