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

Unable to import attachment with an unexpected character in filename #2600

Closed
nfk opened this issue Nov 17, 2021 · 3 comments
Closed

Unable to import attachment with an unexpected character in filename #2600

nfk opened this issue Nov 17, 2021 · 3 comments

Comments

@nfk
Copy link
Contributor

nfk commented Nov 17, 2021

Description of problem

On test run when I filled a comment in a test case I tried to attach a file with a name like this Screenshot_20211117-164527_Paramètres.png A popup raised with an error message and the file was not attached.
It works fine when I rename the filename without the è charcter.

Version or commit hash (if applicable)

Kiwi 10.4

Steps to Reproduce

  1. Play a test run
  2. Open a test case
  3. On the top bar of the text area click on Insert Image
  4. Attach a file with this name Screenshot_20211117-164527_Paramètres.png

Actual results

A popup raises with this error message nternal error: 'ascii' codec can't encode character '\xe8' in position 71: ordinal not in range(128)

Expected results

The file is attached successfully.

Additional info (Python traceback, logs, etc.)

@atodorov
Copy link
Member

atodorov commented Dec 8, 2021

This is a duplicate of #350, which is reported upstream at bartTC/django-attachments#49.

I managed to reproduce with a file name Screenshot_2021-12-07 Плащане.png.

@nfk we're currently running the latest version of django-attachments on Python 3.8 but somehow this bug still appears. Are you able to help reproduce upstream ?

@nfk
Copy link
Contributor Author

nfk commented Dec 8, 2021

Hi @atodorov,

I can reproduce this issue on https://public.tenant.kiwitcms.org/runs/3507/ with the a filename like this écran prioritè.jpg.

@atodorov
Copy link
Member

This blog post gives the answer https://leimao.github.io/blog/Docker-Locale/ to what the root problem is.

RUN microdnf --nodocs install glibc-langpack-en

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

will solve the issue but I need some time to figure out how to design the test for this.

atodorov added a commit that referenced this issue Jan 15, 2022
atodorov added a commit that referenced this issue Jan 15, 2022
atodorov added a commit that referenced this issue Jan 15, 2022
atodorov added a commit that referenced this issue Jan 15, 2022
fixes KIWI-TCMS-GX,
https://sentry.io/organizations/kiwitcms/issues/2539019888/

The root cause of the problem was that the default locale was not UTF-8
compatible and Python would error out when handling UTF-8 filenames.

See also https://leimao.github.io/blog/Docker-Locale/
atodorov added a commit that referenced this issue Jan 15, 2022
fixes KIWI-TCMS-GX,
https://sentry.io/organizations/kiwitcms/issues/2539019888/

The root cause of the problem was that the default locale was not UTF-8
compatible and Python would error out when handling UTF-8 filenames.

See also https://leimao.github.io/blog/Docker-Locale/
atodorov added a commit that referenced this issue Jan 15, 2022
atodorov added a commit that referenced this issue Jan 15, 2022
atodorov added a commit that referenced this issue Jan 15, 2022
atodorov added a commit that referenced this issue Jan 15, 2022
atodorov added a commit that referenced this issue Jan 15, 2022
atodorov added a commit that referenced this issue Jan 15, 2022
fixes KIWI-TCMS-GX,
https://sentry.io/organizations/kiwitcms/issues/2539019888/

The root cause of the problem was that the default locale was not UTF-8
compatible and Python would error out when handling UTF-8 filenames.

See also https://leimao.github.io/blog/Docker-Locale/
atodorov added a commit that referenced this issue Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants