Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add photo to album (Call to undefined method OCA\Photos\Sabre\Album\AlbumRoot::getPath) #1558

Open
p5n opened this issue Dec 27, 2022 · 16 comments
Labels
0. Needs triage Pending approval or rejection. This issue is pending approval. bug Something isn't working feature: albums Related to the albums section Needs review For continued relevance/ validity/ classification

Comments

@p5n
Copy link

p5n commented Dec 27, 2022

To Reproduce

  • Select album
  • press add photo
  • select photo
  • Call to undefined method OCA\Photos\Sabre\Album\AlbumRoot::getPath

Expected behavior
Added photo

Desktop (please complete the following information):

  • OS: ArchLinux
  • firefox 108.0.1-1

Was able to fix it by adding following function to https://github.com/nextcloud/photos/blob/master/lib/Sabre/Album/AlbumRoot.php

$ diff AlbumRoot.php.bak AlbumRoot.php 
84a85,88
> 	public function getPath() {
> 		return $this->rootFolder->getUserFolder($this->userId)->getPath();
> 	}
> 

Not sure if it is correct solution but photo was added somehow.

@p5n p5n added bug Something isn't working 0. Needs triage Pending approval or rejection. This issue is pending approval. labels Dec 27, 2022
@simonspa
Copy link

I somehow cannot reproduce this with master from both NC and Photos.

@p5n
Copy link
Author

p5n commented Jan 21, 2023

With nextcloud 25.0.3 it adds without this patch, but error appeared in top right corner that it failed to add photo.
Also it looks like adding photo from shared read-only folder affects. Own photo was added without error.

@siccovansas
Copy link

I indeed cannot add a photo to an album if the photo is shared with me. I also get the 'Failed to add...' message in the top right corner.

@chmeeedalf
Copy link

I indeed cannot add a photo to an album if the photo is shared with me. I also get the 'Failed to add...' message in the top right corner.

I see the same thing, and it's even more amusing because it happens when I upload a photo to a directory shared with me, and then try to add that photo to an album. I don't see any errors in the logs, just a failed message in the corner.

@joshtrichards
Copy link
Member

Can anyone experiencing this provide the log entry (i.e. the full stack trace) from their nextcloud.log? That will help in getting this issue looked at more closely.

@siccovansas
Copy link

siccovansas commented Jul 7, 2023

Here are my entries from nextcloud.log when trying to add a photo from a shared folder:

{"reqId":"kOBSiSuAOXbscsdOwCve","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"COPY","url":"/remote.php/dav/files/XXXXUSER/XXXXPATH/XXXXFILE.JPG","message":"Creation of dynamic property OCA\\Maps\\Hooks\\FileHooks::$lockingProvider is deprecated at /var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php#46","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"kOBSiSuAOXbscsdOwCve","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"COPY","url":"/remote.php/dav/files/XXXXUSER/XXXXPATH/XXXXFILE.JPG","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"kOBSiSuAOXbscsdOwCve","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"COPY","url":"/remote.php/dav/files/XXXXUSER/XXXXPATH/XXXXFILE.JPG","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"kOBSiSuAOXbscsdOwCve","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"COPY","url":"/remote.php/dav/files/XXXXUSER/XXXXPATH/XXXXFILE.JPG","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"kOBSiSuAOXbscsdOwCve","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"COPY","url":"/remote.php/dav/files/XXXXUSER/XXXXPATH/XXXXFILE.JPG","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"kOBSiSuAOXbscsdOwCve","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"COPY","url":"/remote.php/dav/files/XXXXUSER/XXXXPATH/XXXXFILE.JPG","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"kOBSiSuAOXbscsdOwCve","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"webdav","method":"COPY","url":"/remote.php/dav/files/XXXXUSER/XXXXPATH/XXXXFILE.JPG","message":"Can't add file to album, only files from XXXXUSER can be added","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","exception":{"Exception":"Sabre\\DAV\\Exception\\Forbidden","Message":"Can't add file to album, only files from XXXXUSER can be added","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Tree.php","line":132,"function":"copyInto","class":"OCA\\Photos\\Sabre\\Album\\AlbumRoot","type":"->","args":["XXXXFILE.JPG","files/XXXXUSER/XXXXPATH/XXXXFILE.JPG",["OCA\\DAV\\Connector\\Sabre\\File"]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":659,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->","args":["files/XXXXUSER/XXXXPATH/XXXXFILE.JPG","photos/XXXXUSER/albums/XXXSHAREDALBUM/XXXXFILE.JPG"]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpCopy","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:COPY",[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":366,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":172,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php","Line":167,"message":"Can't add file to album, only files from XXXXUSER can be added","exception":{},"CustomMessage":"Can't add file to album, only files from XXXXUSER can be added"}}
{"reqId":"8hYhXy5WHSy3uGIBZwWn","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"PROPFIND","url":"/remote.php/dav/photos/XXXXUSER/albums/XXXXSHAREDALBUM/","message":"Creation of dynamic property OCA\\Maps\\Hooks\\FileHooks::$lockingProvider is deprecated at /var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php#46","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"8hYhXy5WHSy3uGIBZwWn","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"PROPFIND","url":"/remote.php/dav/photos/XXXXUSER/albums/XXXXSHAREDALBUM/","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"8hYhXy5WHSy3uGIBZwWn","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"PROPFIND","url":"/remote.php/dav/photos/XXXXUSER/albums/XXXXSHAREDALBUM/","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"8hYhXy5WHSy3uGIBZwWn","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"PROPFIND","url":"/remote.php/dav/photos/XXXXUSER/albums/XXXXSHAREDALBUM/","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"8hYhXy5WHSy3uGIBZwWn","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"PROPFIND","url":"/remote.php/dav/photos/XXXXUSER/albums/XXXXSHAREDALBUM/","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"8hYhXy5WHSy3uGIBZwWn","level":0,"time":"2023-07-07T11:15:17+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"XXXXUSER","app":"PHP","method":"PROPFIND","url":"/remote.php/dav/photos/XXXXUSER/albums/XXXXSHAREDALBUM/","message":"Creation of dynamic property OCA\\Photos\\Sabre\\Album\\AlbumRoot::$userConfigService is deprecated at /var/www/html/apps/photos/lib/Sabre/Album/AlbumRoot.php#58","userAgent":"XXXXXXXXXXXXXXXXX","version":"26.0.3.2","data":{"app":"PHP"}}

Line 6 seems to hold a clue: Can't add file to album, only files from XXXXUSER can be added :) (Note: XXXXUSER is a substitute for my username; so it says that I can only add my own files to the album).

As a user I would expect all photos that I can select from the 'Add photos to this album' popup picker to be addable to the album. Given that shared photos are shown in the picker I should be able to add them to the album.

@ubrfkr
Copy link

ubrfkr commented Dec 18, 2023

I still have this issue. Pictures from shared folders can't be added to shared albums.
Is there any progress on this? Or does anyone know a workaround?

@titilambert
Copy link

The error/issue is there:

throw new Forbidden("Can't add file to album, only files from $uid can be added");

But I guess there is a reason why we can not do it ...

@StefanAbl
Copy link

But I guess there is a reason why we can not do it ...

This behavior makes sense in many cases, however there are other use cases in which adding a picture to an album should be possible even though the picture was shared with the user adding it. For example Alice shares a folder and an Album with Bob, Bob should then be allowed to add Alice's pictures to Alice's album.

@HolgerDoerrschuck
Copy link

Hi all, I have two user on my nexcloud 1=boss 2=employee. All pictures are uploaded by boss and the folder is shared with employee. Boss creates now an album and shared this with employee.

Employee can display this album and can remove pictures but he can not add pictures even if they are uploaded by himselfe. For me this is a cleare bug and stops me to use nextcloud with multiple users.

So please - can someone provide a fix for that? I also tried the app groupfolder but this is not really working with memories

@nderambure
Copy link

Same problem here, on 15 differents nextclouds.
If the photo added into an album does not belong to the user, it fails with message "Can't add file to album, only files from...".
Very disturbing since the user can see all images shared with him...

@sbrems
Copy link

sbrems commented Apr 1, 2024

I also have the same issue. To me this is also clearly a bug and really limits my usability of nextcloud. Maybe it comes from the issue what to do with the album, if sharing is ended. But to me it should maybe just be a show list of files not accessible anymore, once the permission is revoked.

@pixelpunk-DE
Copy link

pixelpunk-DE commented Apr 6, 2024

I have the same issue.
Only the owner sharing the folder can add photos to albums.
No matter who uploaded the photos or created the album.
But everyone the album is shared with can delete photos from it.

I also tried to create a group as admin and share a folder with this group. No one in the group can use photos from this folder then.
Transferring the ownership of a folder does not help either.

I would expect the same behavior when the share is revoked as if they were deleted: placeholder thumbs.

Steps to reproduce:

  • Log in as Bob
  • Create and share a folder with Anna
  • Add a photo to folder
  • Log in as Anna
  • Create an album
  • Add photo to album

Or Bob can create an album an add Anna as collaborator, same result.

@dab0u
Copy link

dab0u commented Aug 5, 2024

Same problem here, with the "photo" application or the "memories" one. I can't share a folder and an album with my wife where we could choose which picture we want to show in this album :(

@HolgerDoerrschuck
Copy link

wow .. it is now such a long time ago where a lot of people report this bug and nothing happend.

@joshtrichards
Copy link
Member

The OP in this thread stated this is the error: Call to undefined method OCA\Photos\Sabre\Album\AlbumRoot::getPath

Most of you sound like you're not experiencing that, but #2095. So please make sure you're looking at the correct issue.

@HolgerDoerrschuck You're welcome to jump in, diagnose the root cause, and submit a bug fix in a PR.

@joshtrichards joshtrichards changed the title Cannot add photo to album Cannot add photo to album (Call to undefined method OCA\Photos\Sabre\Album\AlbumRoot::getPath) Aug 5, 2024
@joshtrichards joshtrichards added the Needs review For continued relevance/ validity/ classification label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending approval or rejection. This issue is pending approval. bug Something isn't working feature: albums Related to the albums section Needs review For continued relevance/ validity/ classification
Projects
None yet
Development

No branches or pull requests