Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Add patch for i18n encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
mpolidori committed Dec 5, 2021
1 parent 5481da2 commit 6647b27
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ckan/2.9/setup/patches/ckan/translation_encoding_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/ckan/views/api.py b/ckan/views/api.py
index c7cc44934..3bc21c163 100644
--- a/ckan/views/api.py
+++ b/ckan/views/api.py
@@ -3,6 +3,7 @@
import os
import logging
import html
+import io

from flask import Blueprint, make_response
import six
@@ -479,7 +480,7 @@ def i18n_js_translations(lang, ver=API_REST_DEFAULT_VERSION):
u'base', u'i18n', u'{0}.js'.format(lang)))
if not os.path.exists(source):
return u'{}'
- translations = json.load(open(source, u'r', encoding=u'utf-8'))
+ translations = json.load(io.open(source, u'r', encoding=u'utf-8'))
return _finish_ok(translations)


8 changes: 8 additions & 0 deletions ckan/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ RUN addgroup -g 92 -S ckan && \
RUN mkdir -p $CKAN_STORAGE_PATH && \
chown -R ckan:ckan $CKAN_STORAGE_PATH

## Patches
COPY 2.9/setup/patches ${APP_DIR}/patches
RUN for d in $APP_DIR/patches/*; do \
for f in `ls $d/*.patch | sort -g`; do \
cd $SRC_DIR/`basename "$d"` && echo "$0: Applying patch $f to $SRC_DIR/`basename $d`"; patch -p1 < "$f" ; \
done ; \
done

COPY 2.9/setup/prerun.py ${APP_DIR}
COPY 2.9/setup/supervisor.worker.conf /etc/supervisord.d/worker.conf
COPY 2.9/setup/start_ckan-py2.sh ${APP_DIR}
Expand Down

0 comments on commit 6647b27

Please sign in to comment.