Skip to content

Commit a2d7560

Browse files
Bugfix: Create preview picture URLs correctly if filename contains multiple dots (".")
SQL statement cut off everything after the first dot but should only cut off after the last dot in the filename.
1 parent 07238c2 commit a2d7560

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

include/functions_map.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ function osm_get_items($page)
196196

197197
$query="SELECT i.latitude, i.longitude,
198198
IFNULL(i.name, '') AS `name`,
199-
IF(i.representative_ext IS NULL,
200-
CONCAT(SUBSTRING_INDEX(TRIM(LEADING '.' FROM i.path), '.', 1 ), '-sq.', SUBSTRING_INDEX(TRIM(LEADING '.' FROM i.path), '.', -1 )),
201-
TRIM(LEADING '.' FROM
199+
TRIM(LEADING '.' FROM IF(i.representative_ext IS NULL,
200+
CONCAT(LEFT(i.path,LENGTH(i.path)-1-LENGTH(SUBSTRING_INDEX(i.path, '.', -1 ))), '-sq.', SUBSTRING_INDEX(i.path, '.', -1 )),
202201
REPLACE(i.path, TRIM(TRAILING '.' FROM SUBSTRING_INDEX(i.path, '/', -1 )),
203202
CONCAT('pwg_representative/',
204203
CONCAT(
@@ -207,8 +206,7 @@ function osm_get_items($page)
207206
)
208207
)
209208
)
210-
)
211-
) AS `pathurl`,
209+
)) AS `pathurl`,
212210
TRIM(TRAILING '/' FROM CONCAT( i.id, '/category/', IFNULL(ic.category_id, '') ) ) AS `imgurl`,
213211
IFNULL(i.comment, '') AS `comment`,
214212
IFNULL(i.author, '') AS `author`,

0 commit comments

Comments
 (0)