Error using Piwigo from Android with smartpocket theme #879

Closed
opened 2026-10-05 00:22:27 +02:00 by adam · 3 comments
Owner

Using smartPocket in Android phone give me this error:
"Uncaught TypeError: Cannot read property 'toString' of null " in 1b3aqxj.js:formatted:12049.
I did a little of debugging and I found that the error is here e.navigator.userAgent.match(/Android (\d+.\d+)/) because the userAgent is a string like "Mozilla/5.0 (Linux; Android 9; moto x4) AppleWebKi…e Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36" so the Android version doesn't have a decimal value and the match function return null so there is an error.

Using smartPocket in Android phone give me this error: `"Uncaught TypeError: Cannot read property 'toString' of null " in 1b3aqxj.js:formatted:12049`. I did a little of debugging and I found that the error is here `e.navigator.userAgent.match(/Android (\d+.\d+)/)` because the userAgent is a string like `"Mozilla/5.0 (Linux; Android 9; moto x4) AppleWebKi…e Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36" `so the Android version doesn't have a decimal value and the match function return null so there is an error. <!-- github-sync-id:435665278 -->
adam closed this issue 2026-10-05 00:22:27 +02:00
Author
Owner

I solved by editing the file _data/combined/1b3aqxj.js
From
e.navigator.userAgent.match(/Android (\d+.\d+)/).repl...
to
e.navigator.userAgent.match(/Android (\d+)/).repl...
I know it's only a temporary solution but with this the gallery works again.

I solved by editing the file _data/combined/1b3aqxj.js From `e.navigator.userAgent.match(/Android (\d+.\d+)/).repl...` to `e.navigator.userAgent.match(/Android (\d+)/).repl...` I know it's only a temporary solution but with this the gallery works again. <!-- github-comment-id:485746518 -->
Author
Owner

I can confirm this observation.

My solution is a little different, but the basic idea is the same.

I have sent a pull request [1]. Hopefully it helps with other people that prefer to browse the photos on a phone.

[1] https://github.com/Piwigo/Piwigo/pull/1045

I can confirm this observation. My solution is a little different, but the basic idea is the same. I have sent a pull request [1]. Hopefully it helps with other people that prefer to browse the photos on a phone. [1] https://github.com/Piwigo/Piwigo/pull/1045 <!-- github-comment-id:508094062 -->
Author
Owner

@mozzenior your pull-request works nice. Thanks! I'm happy it works because the other solution would be rewrite the photoswipe implementation to match the new PhotoSwipe 4 API.

@mozzenior your pull-request works nice. Thanks! I'm happy it works because the other solution would be rewrite the photoswipe implementation to match the new PhotoSwipe 4 API. <!-- github-comment-id:510862597 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#879