nextcloud / unsplash

📸🔀☁️ Random Nextcloud log in background from Unsplash
https://apps.nextcloud.com/apps/unsplash
GNU Affero General Public License v3.0
92 stars 23 forks source link

Tags containing umlaut characters not working #125

Open E5rael opened 1 year ago

E5rael commented 1 year ago

Describe the bug: Images containing umlaut characters (e.g. Ä or Ö) in their tags aren't displaying.

To Reproduce: Steps to reproduce the behavior:

  1. Go to Splash settings
  2. List only tags containing umlaut characters, for example jönköping, hämeenlinna, jyväskylä
  3. Refresh the page, and an error background image is displayed.

Expected behavior: Images containing these tags should appear.

Server:

Additional Information:

timonsky commented 11 months ago

Line 116 in lib/ProviderHandler/Provider.php is responsible for that behaviour $term = preg_replace('/[^a-z]/i','', $term);

does not only affect umlauts, but basically any character that is not in the range U+0061 to U+007A (standard latin lowercase letters)  

I also tried adding cyrillic tags, such as Москва, and it seemed to work.

that's because it results in an empty search string, so you just got a completely random image, not necessarily with any relation to moscow

 

I'm taking the comment line // only allow letters as searchterm as that it was a design choice with a rationale.