photos icon indicating copy to clipboard operation
photos copied to clipboard

Photos-App Settings context will insert arrays with string literals into configvalue of the database, instead of string-literals

Open CarboHydr opened this issue 7 months ago • 15 comments

Describe the bug Photos: v4.0.0-dev.1

Nextcloud v31.0.5

OS: Arch Linux nginx v1.27.5 mariadb v.11.7.2

Any changes in "Media Folders" and "Upload Folder" will cause the DB entry in oc_preferences to contain the an array similar to ["/path/to/folder"] for the column configvalue. In the case of "Media Folders" the entry will be inserted into the array causing a type exception when calling the photos app and rendering the "Media Folders" list empty. This will cause type exceptions in the browser console, when entering context where the configvalue is used, and no items for the paths or in the Photo-View to be shown. In the case of "Upload Folder" config value will be interpreted as /["/path/to/actual/folder"] in the folder picker on attempting another change, if /path/to/actual/folder was previously picked and confirmed.

Manually changing/updating the values in the database to conform with ["/pathliteral1","/pathliteral2"...] for "Media Folders" or /pathliteral for "Upload Folder" will correct the issue.

To Reproduce Steps to reproduce the behavior:

  1. Attempt to add or change folder for "Media Folders" or "Upload Folder" in Photos-App Settings context, ending in confirming the path selection in the folder picker.

Expected behavior Media Folders: configvalue should be a 1D array with "-terminated string literals representing the paths Upload Folder: configvalue should be an unterminated string literal representing the path

Desktop

  • OS: Arch Linux
  • Browser: Any (Firefox, LibreWolf, Falkon, Chromium)

Server

  • Nextcloud: 31.0.5
  • Photos: 4.0.0-dev.1
  • OS: Arch Linux
  • nginx: 1.27.5
  • mariadb: 11.7.2

Browser log

Firefox

[WARN] viewer: Some mimes were ignored because they are not enabled in the server previews config 
Object { app: "viewer", uid: "nb", level: 2, ignoredMimes: (3) […] }
[index.mjs:51:16](https://concreteserver.ddns.net/nextcloud/apps/viewer/node_modules/@nextcloud/logger/dist/index.mjs)
OCA.Files.Sidebar initialized [Sidebar.js:19:10](webpack:///nextcloud/apps/files/src/services/Sidebar.js)
OCA.Comments.View initialized [comments-app.js:15:8](webpack:///nextcloud/apps/comments/src/comments-app.js)
OCA.Sharing.ShareSearch initialized [ShareSearch.js:16:10](webpack:///nextcloud/apps/files_sharing/src/services/ShareSearch.js)
OCA.Sharing.ExternalLinkActions initialized [ExternalLinkActions.js:16:10](webpack:///nextcloud/apps/files_sharing/src/services/ExternalLinkActions.js)
OCA.Sharing.ExternalShareActions initialized [ExternalShareActions.js:16:10](webpack:///nextcloud/apps/files_sharing/src/services/ExternalShareActions.js)
session heartbeat polling started [session-heartbeat.js:83:9](webpack:///nextcloud/core/src/session-heartbeat.js)
Notifications permissions granted [NotificationsApp.vue:417](https://concreteserver.ddns.net/nextcloud/apps/notifications/src/NotificationsApp.vue)
Polling interval updated to 30000 [NotificationsApp.vue:380](https://concreteserver.ddns.net/nextcloud/apps/notifications/src/NotificationsApp.vue)
Started background fetcher as session_keepalive is enabled [NotificationsApp.vue:251](https://concreteserver.ddns.net/nextcloud/apps/notifications/src/NotificationsApp.vue)
Got notification data, restoring default polling interval. [NotificationsApp.vue:336](https://concreteserver.ddns.net/nextcloud/apps/notifications/src/NotificationsApp.vue)
Content-Security-Policy: The report URI (about:blank) should be an HTTP or HTTPS URI. [Photos.vue:197](webpack:///photos/src/Photos.vue)
Content-Security-Policy: (Report-Only policy) The page’s settings would block a worker script (worker-src) at https://concreteserver.ddns.net/nextcloud/index.php/apps/photos/service-worker.js from being executed because it violates the following directive: “worker-src 'none'” [Photos.vue:197](webpack:///photos/src/Photos.vue)
Content-Security-Policy: The report URI (about:blank) should be an HTTP or HTTPS URI. [photos](https://concreteserver.ddns.net/nextcloud/apps/photos/)
Content-Security-Policy: (Report-Only policy) The page’s settings would block a worker script (worker-src) at https://concreteserver.ddns.net/nextcloud/index.php/apps/photos/service-worker.js from being executed because it violates the following directive: “worker-src 'none'” [photos](https://concreteserver.ddns.net/nextcloud/apps/photos/)
TypeError: this.path.split is not a function
    folderName PhotosFolder.vue:71
    VueJS 3
    C PhotosFolder.vue:1
    VueJS 24
[vue.runtime.esm.js:3065:16](webpack:///photos/node_modules/vue/dist/vue.runtime.esm.js)
[ERROR] photos: Error fetching files 
Object { app: "photos", uid: "nb", level: 2, error: TypeError }
[ConsoleLogger.js:74:18](webpack:///photos/node_modules/@nextcloud/logger/dist/ConsoleLogger.js)
[ERROR] photos: Error fetching files 
Object { app: "photos", uid: "nb", level: 2, error: TypeError }
[ConsoleLogger.js:74:18](webpack:///photos/node_modules/@nextcloud/logger/dist/ConsoleLogger.js)
TypeError: this.path.split is not a function
    folderName PhotosFolder.vue:71
    VueJS 3
    C PhotosFolder.vue:1
    VueJS 4
[vue.runtime.esm.js:3065:16](webpack:///photos/node_modules/vue/dist/vue.runtime.esm.js)
Uncaught (in promise) Error: FilePicker: No nodes selected
    u index.mjs:18
    pickNodes index.mjs:62
    close dialog.mjs:14
    VueJS 4
    handleClose FilePicker-Bp973DaS.mjs:1059
    VueJS 4
    f NcDialog-D2lwwZL-.mjs:224
    VueJS 4
    close NcModal.mjs:440
[index.mjs:18](webpack:///photos/node_modules/@nextcloud/dialogs/dist/index.mjs)
Falkon

Error with Feature-Policy header: Unrecognized feature: 'payment'.
images.js:55 [WARN] viewer: Some mimes were ignored because they are not enabled in the server previews config {app: 'viewer', uid: 'nb', level: 2, ignoredMimes: Array(3)}
log @ index.mjs:51
warn @ index.mjs:69
(anonymous) @ images.js:55
Show 2 more frames
Show less
session-heartbeat.js:83 session heartbeat polling started
FetchFilesMixin.js:109 [ERROR] photos: Error fetching files {app: 'photos', uid: 'nb', level: 2, error: TypeError: n.charAt is not a function
    at i (https://concreteserver.ddns.net/nextcloud/apps/phot…}
value @ ConsoleLogger.js:74
value @ ConsoleLogger.js:100
fetchFiles @ FetchFilesMixin.js:109
await in fetchFiles
getContent @ Timeline.vue:263
fn @ vue.runtime.esm.js:3033
n @ vue.runtime.esm.js:1832
fn @ vue.runtime.esm.js:3033
e.$emit @ vue.runtime.esm.js:3732
needContent @ FilesListViewer.vue:229
fn @ vue.runtime.esm.js:3033
n @ vue.runtime.esm.js:1832
fn @ vue.runtime.esm.js:3033
e.$emit @ vue.runtime.esm.js:3732
isNearBottom @ VirtualScrolling.vue:259
fn @ vue.runtime.esm.js:3033
e.run @ vue.runtime.esm.js:3550
oa @ vue.runtime.esm.js:4141
(anonymous) @ vue.runtime.esm.js:3159
yn @ vue.runtime.esm.js:3081
Promise.then
vn @ vue.runtime.esm.js:3106
xn @ vue.runtime.esm.js:3171
sa @ vue.runtime.esm.js:4227
e.update @ vue.runtime.esm.js:3529
e.notify @ vue.runtime.esm.js:732
set @ vue.runtime.esm.js:976
Na.Ba.set @ vue.runtime.esm.js:5376
(anonymous) @ VirtualScrolling.vue:297
Show 22 more frames
Show less
FetchFilesMixin.js:109 [ERROR] photos: Error fetching files {app: 'photos', uid: 'nb', level: 2, error: TypeError: n.charAt is not a function
    at i (https://concreteserver.ddns.net/nextcloud/apps/phot…}
value @ ConsoleLogger.js:74
value @ ConsoleLogger.js:100
fetchFiles @ FetchFilesMixin.js:109
await in fetchFiles
getContent @ Timeline.vue:263
fn @ vue.runtime.esm.js:3033
n @ vue.runtime.esm.js:1832
fn @ vue.runtime.esm.js:3033
e.$emit @ vue.runtime.esm.js:3732
needContent @ FilesListViewer.vue:229
fn @ vue.runtime.esm.js:3033
n @ vue.runtime.esm.js:1832
fn @ vue.runtime.esm.js:3033
e.$emit @ vue.runtime.esm.js:3732
visibleSections @ VirtualScrolling.vue:267
fn @ vue.runtime.esm.js:3033
e.run @ vue.runtime.esm.js:3550
oa @ vue.runtime.esm.js:4141
(anonymous) @ vue.runtime.esm.js:3159
yn @ vue.runtime.esm.js:3081
Promise.then
vn @ vue.runtime.esm.js:3106
xn @ vue.runtime.esm.js:3171
sa @ vue.runtime.esm.js:4227
e.update @ vue.runtime.esm.js:3529
e.notify @ vue.runtime.esm.js:732
set @ vue.runtime.esm.js:976
Na.Ba.set @ vue.runtime.esm.js:5376
(anonymous) @ VirtualScrolling.vue:297
Show 22 more frames
Show less
NotificationsApp.vue:434 Notifications permissions not yet requested

Additional context Database Changes, when first adding a new folder to the "Media Folders" and than changing the "Upload Folder"

MariaDB [nextcloud]> select * from oc_preferences where appid='photos';
+--------+--------+---------------------+-----------------------------+------+------+-------+---------+
| userid | appid  | configkey           | configvalue                 | lazy | type | flags | indexed |
+--------+--------+---------------------+-----------------------------+------+------+-------+---------+
| test   | photos | photosSourceFolders | ["/Photos","/SofortUpload"] |    0 |    0 |     0 |         |
+--------+--------+---------------------+-----------------------------+------+------+-------+---------+
1 row in set (0,001 sec)

MariaDB [nextcloud]> select * from oc_preferences where appid='photos';
+--------+--------+---------------------+---------------------------------------+------+------+-------+---------+
| userid | appid  | configkey           | configvalue                           | lazy | type | flags | indexed |
+--------+--------+---------------------+---------------------------------------+------+------+-------+---------+
| test   | photos | photosSourceFolders | ["/Photos","/SofortUpload",["/ADAC"]] |    0 |    0 |     0 |         |
+--------+--------+---------------------+---------------------------------------+------+------+-------+---------+
1 row in set (0,000 sec)

MariaDB [nextcloud]> select * from oc_preferences where appid='photos';
+--------+--------+---------------------+---------------------------------------+------+------+-------+---------+
| userid | appid  | configkey           | configvalue                           | lazy | type | flags | indexed |
+--------+--------+---------------------+---------------------------------------+------+------+-------+---------+
| test   | photos | photosLocation      | ["/SofortUpload"]                     |    0 |    0 |     0 |         |
| test   | photos | photosSourceFolders | ["/Photos","/SofortUpload",["/ADAC"]] |    0 |    0 |     0 |         |
+--------+--------+---------------------+---------------------------------------+------+------+-------+---------+
2 rows in set (0,001 sec)

CarboHydr avatar May 18 '25 09:05 CarboHydr

Having the same issue on docker version, this bug is making the Photos App webUI unusable.

ljcucc avatar May 22 '25 14:05 ljcucc

Same issue here. Additionaly to not beeing able to add further folders to the mediafolder.

GaryPotthead1881 avatar May 23 '25 09:05 GaryPotthead1881

The same problem

userid appid configkey configvalue lazy type flags indexed
... photos photosSourceFolders ["/Photos",["/InstantUpload/Camera/2025"]] 0 0 0

yuriry avatar May 23 '25 15:05 yuriry

I have the same problem, Photo App tells "an error occured" and wrong characters in Path setup. Would be nice to have an quick workaround. Memories works correct !

clown-m avatar May 28 '25 12:05 clown-m

Same issue here, no folders available, can't add them, and in path setup shows brackets. Manually changing the database record fixed the issue as described in the linked issue.

Myuuiii avatar May 28 '25 12:05 Myuuiii

Same issue as well. Please send a quick correction. Thanks

duartes1005 avatar May 28 '25 19:05 duartes1005

If you need this to be fixed quickly and (probably) temporarily like OC did in the issue, you can use this SQL statement to change the record for a user. Please do make sure to back up the records just in case, don't trust anything :)

UPDATE nextcloud.oc_preferences t
SET t.configvalue = '["/path/to/a/folder", "/path/to/another/folder"]'
WHERE t.userid = 'YOUR_USERNAME_HERE'
  AND t.appid = 'photos'
  AND t.configkey = 'photosSourceFolders';

You can do the same for the t.configkey = 'photosLocation' for the upload location. Probably only use 1 path there though

Myuuiii avatar May 28 '25 21:05 Myuuiii

@Myuuiii Thank you, it's solved for load picture files (photosLocation). But for "photosSourceFolders" the UI on field "Folders to upload" display " Fotos"] ". Several thumbs not load. NC 31.0.5 / PHP 8.3.6 / MariaDB 11.4.7

Image

linkoficial avatar May 30 '25 14:05 linkoficial

I deleted the original "Photos" directory and wanted to add another media directory. after that i only see "an error occured" and thats it. Browser Console gives the following:

FetchFilesMixin.js:109 [ERROR] photos: Error fetching files {app: 'photos', uid: '########', level: 2, error: TypeError: n.charAt is not a function at i (https://#############.de/apps/photos/js/photos-main…} app : "photos" error : TypeError: n.charAt is not a function at i (https://########.de/apps/photos/js/photos-main.js?v=120e0927-26:1:2323567) at https://#########.de/apps/photos/js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js?v=a22ccd783b85f3803c18:1:2729 at Array.map (<anonymous>) at https://##########.de/apps/photos/js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js?v=a22ccd783b85f3803c18:1:2675 at o.fetchFiles (https://############.de/apps/photos/js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js?v=a22ccd783b85f3803c18:1:4212) message : "n.charAt is not a function" stack : "TypeError: n.charAt is not a function\n at i (https://#################.de/apps/photos/js/photos-main.js?v=120e0927-26:1:2323567)\n at https://###########.de/apps/photos/js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js?v=a22ccd783b85f3803c18:1:2729\n at Array.map (<anonymous>)\n at https://###############.de/apps/photos/js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js?v=a22ccd783b85f3803c18:1:2675\n at o.fetchFiles (https://###########.de/apps/photos/js/photos-node_modules_vue-material-design-icons_ArrowLeft_vue-src_views_Timeline_vue.js?v=a22ccd783b85f3803c18:1:4212)" [[Prototype]] : Error level : 2 uid : "##############" [[Prototype]] : Object fetchFiles @ FetchFilesMixin.js:109 await in fetchFiles getContent @ Timeline.vue:263 needContent @ FilesListViewer.vue:229 visibleSections @ VirtualScrolling.vue:267 Promise.then (anonymous) @ VirtualScrolling.vue:297

Image

Knutowskie avatar Jun 03 '25 23:06 Knutowskie

The issue is (was) in nextcloud/dialogs and fixed in version 6.3.0 (https://github.com/nextcloud-libraries/nextcloud-dialogs/pull/1777)

tuxArg avatar Jun 09 '25 18:06 tuxArg

So in order to fix this, that dependency needs to be bumped.

LorbusChris avatar Jun 13 '25 08:06 LorbusChris

The issue has been fixed in NextCloud Server version 31.0.6

linkoficial avatar Jun 13 '25 13:06 linkoficial

The issue has been fixed in NextCloud Server version 31.0.6

I'm on 31.0.6 and it doesn't recover from the error at least.

trajano avatar Jun 14 '25 05:06 trajano

On the new version 31.0.6, I newly set the path via the webportal and then it worked. It will not correct the wrong path by it's own.

clown-m avatar Jun 14 '25 08:06 clown-m

I set the path on the db as per https://github.com/nextcloud/photos/issues/3025#issuecomment-2917613697 and that worked out for me.

trajano avatar Jun 14 '25 16:06 trajano