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

Static files serving: folder name can't begin with '/' #101

Closed
jrlemieux opened this issue Dec 26, 2023 · 0 comments · Fixed by #111
Closed

Static files serving: folder name can't begin with '/' #101

jrlemieux opened this issue Dec 26, 2023 · 0 comments · Fixed by #111

Comments

@jrlemieux
Copy link

I have the following route for static files (yes, copied from the example!):

  @cask.staticFiles("/static/file", headers = Seq("Cache-Control" -> "max-age=31536000"))
  def staticFileRoutes(): String =
    val r = Constants.outputDirectory
    println(s"JLX: static folder returned: '$r'.")
    r

When I use an output directory name (value of "Constants.outputDirectory" above) starting with one or multiple '/', the Cask framework strips the leading '/', resulting in a file not found error.

It took me a long time to figure out what was the error. I found it using strace, which shows clearly that the file that the web server tries to open does not start with the '/' character.

strace output:

write(1, "TTS_OUTPUT_DIRECTORY = /entrepot"..., 36TTS_OUTPUT_DIRECTORY = /entrepot/tts) = 36
[pid 1184012] futex(0x7fd9b0062e7c, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=5573577, tv_nsec=522348891}, FUTEX_BITSET_MATCH_ANYJLX: static folder returned: '/entrepot/tts'. <unfinished ...>
[pid 1184025] access("entrepot/tts/toto.ogg", F_OK) = -1 ENOENT (No such file or directory)

Thank you.

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 a pull request may close this issue.

1 participant