laurilehmijoki/s3_website

Support for accents

clorichel opened this issue · 3 comments

I wasn't able to upload any file/directory coming with accents:

[wait] Failed to upload albums/de??couverte (/_site/albums/de??couverte (No such file or directory)
       java.io.FileInputStream.open(Native Method)
       java.io.FileInputStream.<init>(FileInputStream.java:146)
       java.io.FileInputStream.<init>(FileInputStream.java:101)
       sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
       sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
       org.apache.tika.io.TikaInputStream.get(TikaInputStream.java:395)
       org.apache.tika.Tika.detect(Tika.java:265)
       org.apache.tika.Tika.detect(Tika.java:248)
       s3.website.model.Upload$$anonfun$contentType$1$$anonfun$6.apply(push.scala:75)
       s3.website.model.Upload$$anonfun$contentType$1$$anonfun$6.apply(push.scala:75)
       scala.Option.getOrElse(Option.scala:121)
       s3.website.model.Upload$$anonfun$contentType$1.apply(push.scala:75)
       s3.website.model.Upload$$anonfun$contentType$1.apply(push.scala:60)
       scala.util.Success$$anonfun$map$1.apply(Try.scala:237)
       scala.util.Try$.apply(Try.scala:192)
       scala.util.Success.map(Try.scala:237)
       s3.website.model.Upload.contentType$lzycompute(push.scala:60)
       s3.website.model.Upload.contentType(push.scala:60)
       s3.website.S3$$anonfun$toPutObjectRequest$1$$anonfun$apply$3.apply(S3.scala:69)
       s3.website.S3$$anonfun$toPutObjectRequest$1$$anonfun$apply$3.apply(S3.scala:68)
       scala.util.Success.flatMap(Try.scala:231)
       s3.website.S3$$anonfun$toPutObjectRequest$1.apply(S3.scala:68)
       s3.website.S3$$anonfun$toPutObjectRequest$1.apply(S3.scala:66)
       scala.util.Either.fold(Either.scala:98)
       s3.website.S3$.toPutObjectRequest(S3.scala:65)
       s3.website.S3$$anonfun$uploadToS3$1.apply(S3.scala:32)
       s3.website.S3$$anonfun$uploadToS3$1.apply(S3.scala:31)
       scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
       scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
       java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
       java.lang.Thread.run(Thread.java:745)). Trying again in 1 second.

Here, the folder is labelled découverte, but in the log it shows de??couverte. I promise découverte folder exists but not de??couverte 🤓

Any clue?

Just tried to create the folder manually with accent on the S3 bucket before a new push, but sadly:

...
[succ] Deleted albums/d?couverte/
...

What's the locale setting of your environment? You'll see it by executing thelocale command in your shell.

Your problem might be caused by a non UTF-8 locale. I say this because I was able to upload a file in the directory named découverte.

Here's are my locale settings:

$ locale
LANG=
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

Oh, I'm afraid I should have think about this: running inside a docker container where locale was all set to POSIX...

Restarting the container with -e LANG=C.UTF-8 did the job!

Closing. Thanks for your time and help, Lauri!