FIX: Return consistent character encodings when downloading S3 uploads

Net::HTTP always returns ASCII-8BIT encoding. File.read auto-detects the encoding. This leads to an encoding inconsistency between a fresh download, and a cached download. This commit ensures all downloaded files are treated equally, by always returning the cached version from the filesystem, even during initial download.

One symptom of this problem is during theme exports: https://meta.discourse.org/t/116907

Related ruby ticket: https://bugs.ruby-lang.org/issues/2567
This commit is contained in:
David Taylor
2019-05-17 11:26:08 +01:00
parent b05d7042ae
commit ef660d5a3e
2 changed files with 30 additions and 0 deletions

View File

@@ -85,6 +85,7 @@ module FileStore
follow_redirect: true
)
cache_file(file, filename)
file = get_from_cache(filename)
end
file