Make estimateNumberOfImages work for non-string values

Images didn't load. When getting to `v.startsWith(prefix)`, this would fail when `v` isn't a string.

For example for node <http://127.0.0.1:1234/theme.html?layout=artwork&z=18.3&lat=51.14639600620251&lon=3.112295470573372#node/12800197366>
we can see that the tags include `changeset: 165629229, uid: 14124839, version: 2`...

There was already a check to see if there is a value (or was it meant as a check for empty string?),
now we also check more specifically if this value is a string.

Maybe `if (typeof(v) !== 'string')` would also work (without `!v || `),
but then it won't match on empty string any more, and I don't know if that was the goal or not.
This commit is contained in:
ilja space 2025-05-03 09:56:05 +02:00
parent 4de1c8d563
commit df40dc1ba7

View file

@ -96,7 +96,7 @@ export default class AllImageProviders {
for (const prefix of allPrefixes) {
for (const k in tags) {
const v = tags[k]
if (!v) {
if (!v || typeof(v) !== 'string') {
continue
}
if (AllImageProviders.dontLoadFromPrefixes.some(prefix => v.startsWith(prefix))) {