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

Drag and drop hangs for artists with non ISO-8859-1 characters #370

Open
dolan-peter opened this issue May 20, 2022 · 1 comment
Open

Drag and drop hangs for artists with non ISO-8859-1 characters #370

dolan-peter opened this issue May 20, 2022 · 1 comment
Labels

Comments

@dolan-peter
Copy link

dolan-peter commented May 20, 2022

Describe the bug
When an image is dragged to an artist with non ISO-8859-1 characters the system hangs with "Uploading File" text

HiFiBerryOS version
20220228

HiFiBerry sound card
Digi+ Pro

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Sources'
  2. Click on 'Music'
  3. Click on 'ARTISTS'
  4. Scroll down to 'artist with non ISO-8859-1 characters (such as) Натали
  5. Drag image to artist

Expected behavior
The upload should succeed and the artist image should update

Screenshots

Browser (if applicable)

  • OS: Windows
  • Browser [e.g. chrome, safari]: all that I tried (Edge/Chrome/Firefox/Vivaldi)
  • Version [e.g. 22]

Additional context
The problem arises from the fetch() function not parsing HTTP-headers with non ISO-8859-1 characters. It can be fixed by minor changes to the source code of two files:

  1. Add a line to /opt/beocreate/beo-views/default/scripts/beo-ui.js to escape the artist before sending the request:
2163-           if (canUpload) {
2164:                   if(options && options.customData && options.customData.artist) options.customData.artist=escape(options.customData.artist); // Ensure artist can use non ISO 8859-1 characters
2165-                   uploadNotifyTimeout = setTimeout(function() {
  1. Add a line to /opt/beocreate/beo-system/beo-server.js to return the encoded text to utf-8 before processing the upload:
415-                    if (req.header("customData")) {
416-                            customData = JSON.parse(req.header("customData"));
417:                            if(customData.artist) customData.artist = unescape(customData.artist); //Added to internationalize artists
418-                    } else {
419-                            customData = null;
420-                    }
@hifiberry
Copy link
Owner

Can you provide a PULL request to this repo?
https://github.com/hifiberry/create

@hifiberry hifiberry added the bug label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants