jcorporation / myMPD

myMPD is a standalone and mobile friendly web mpd client with a tiny footprint and advanced features.
https://jcorporation.github.io/myMPD/
GNU General Public License v3.0
418 stars 65 forks source link

Problem adding Albums with greek characters from both database and filesystem #60

Closed ghost closed 6 years ago

ghost commented 6 years ago

I have lots of albums with greek characters on both tags and filenames/directories. All of them appear in filesystem and database views but the options "Append to queue/Replace queue/Add to playlist" menu never appears on them if I click on the album cover in database view or on the cross symbol in filesystem view.

I don't know if it happens with other languages too. I can only test with Greek.

The myMPD version I use is 4.2.1.

Emilot commented 6 years ago

Error message:

InvalidCharacterError: String contains an invalid character mympd.min.js:113 addMenuItem http://192.168.0.207/js/mympd.min.js:113:135 showMenu http://192.168.0.207/js/mympd.min.js:115:135 appInit/< http://192.168.0.207/js/mympd.min.js:36:372

If i click on then song name, the song added successfully in the queue. From Menu at the left, it throws the error i mention. Even in the queue(if i added it through click on the name as i mention) i cannot remove the song if i wanted to, because when i click on the "+", throws the same error.

jcorporation commented 6 years ago

Can you test it with non-minified files and post the error here?

Emilot commented 6 years ago

One is at line 1716, which is this function: function addMenuItem(href, text) { return '<a class="dropdown-item" href="#" data-href=\'' + btoa(JSON.stringify(href)) + '\'>' + text +''; }

The other is 1743 line: menu += addMenuItem({"cmd": "appendQueue", "options": [type, uri, name]}, 'Append to queue') +

and the other is 434 line: else if (event.target.nodeName == 'A') { showMenu(event.target, event); }

InvalidCharacterError: String contains an invalid character mympd.min.js:1716 addMenuItem http://192.168.0.207/js/mympd.min.js:1716:63 showMenu http://192.168.0.207/js/mympd.min.js:1743:17 appInit/< http://192.168.0.207/js/mympd.min.js:434:13

jcorporation commented 6 years ago

It seems it is a unicode problem of base44 encode and decode: https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding

I implemented the solution 1 in linked document in the devel branch. Can you please test it?

Emilot commented 6 years ago

Case closed. One more annoying bug goes down.

Thanx JC. Great work.