janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.01k stars 1.28k forks source link

Leading spaces are not being trimed on the Publisher & Identifiers field. #3015

Open T-prog3 opened 3 months ago

T-prog3 commented 3 months ago

Describe the bug/problem I did just notice that space characters at the beginning of the Publisher field are not being trimmed when you save. This creates an issue where you can have MyBookPublisher and MyBookPublisher if you don't notice the space yourself.

This issue affects both Identifiers fields as well but here you also have the additional problem of ending spaces not being removed. All other fields works as the should.

OzzieIsaacs commented 3 months ago

From reading the code I can't see the issue (and also not reproduce for publishers), for identifiers the problem is there

T-prog3 commented 3 months ago

I got this issue by copy/paste the publisher data from amazon. img1

In Calibre-Web it becomes this when i paste: img2

When i save it turns into this: img3

In this state with a space as first char it can't be found in the Publishers list in the side menu and it will be treated as a different publisher. I can thereby have 100 books of publisher Ecco and lets say 5 "Space"Ecco and they will have 2 separate lists when you click on the publisher name at the books page.

T-prog3 commented 3 months ago

Update: I did a character lookup of the content when i paste in Calibre-Web and it turns out that it's not just a space but another character as well.

This is the Unicode character content of it:

U+0020 : SPACE [SP] U+200E : LEFT-TO-RIGHT MARK [LRM] U+0020 : SPACE [SP] U+0045 : LATIN CAPITAL LETTER E U+0063 : LATIN SMALL LETTER C U+0063 : LATIN SMALL LETTER C U+006F : LATIN SMALL LETTER O