nextcloud/unsplash

Tags with dashes not working

timonsky opened this issue ยท 1 comments

use GitHub reactions ๐Ÿ‘ to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

  • I have searched the issuetracker if the issue is not already reported.
  • This is not a feature request
  • This is not an image-provider request

Describe the bug:
Using keywords that contain dashes ('-') does not work. It seems the dashes are stripped before being passed to the URL builder.

To Reproduce:
Steps to reproduce the behavior:

  1. Go to the Splash section in admin theming
  2. enter a keyword containing dashes (eg. 'picos-de-europa')
  3. reload the page
  4. right-clicking in the browser where the picture is visible (for me it was in the empty space next to the app tray; at the very edge should also work)
  5. getting the url from the 'Copy Image Link' shows that the url called is https://source.unsplash.com/featured/1920x1080?picosdeeuropa as in the tag had the dashes stripped

Expected behavior:
Images should be taken from the tag containing dashes (e.g. https://source.unsplash.com/featured/1920x1080?picos-de-europa)

Server:

  • Nextcloud version: 27.0.1
  • Splash-App version: 2.2.1

Additional Information:

  • Might be related to #125
  • with the tag 'picos-de-europa' it's especially noticeable as the tag 'picosdeeuropa' only has one image associated compared to 10k for the dashed one
  • 'aurora-borealis' vs 'auroraborealis' is another example

guessing it's this line that's responsible

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