Repository navigation
"Integrity constraint violation" when sharing the same item twice with the same user - #14580
Conversation
There was a problem hiding this comment.
please use connection->executeQuery() right away
There was a problem hiding this comment.
again, this is only temporary and the problem is something else.
|
Tested, and indeed the local share is overwritten by the mountpoint 😿 |
|
Okay, the problem is OC_Helper::buildNotExistingFileNameForView only checks for existance, but does not create the folder/file, in case we need to reserve it for something. What we can do is, use a unique ID for the mount name, and generate the real mount point name at the time where we actually mount the share (by accepting it) |
be4601b to
0b54ae5
Compare
|
I think I fixed it in a good way, would be nice if mount point/sharing guys can have a look, since this is rather urgent/critical. The broken scenarios from above are also something for the testing list @jnfrmarks |
|
@DeepDiver1975 @karlitschek should backport this :/ |
92d8e60 to
9053fb8
Compare
There was a problem hiding this comment.
There query has a limit = 1, so I don't think its necessary?
There was a problem hiding this comment.
or fetchAll() might do too, if I remember well it might automatically close the cursor.
There was a problem hiding this comment.
I'm not sure how Doctrine or the database works. I wouldn't trust the DB to be clever enough to auto-close cursors (hint: Oracle...)
|
Code makes sense, as discussed. |
|
@nickvergessen are unit tests possible? |
|
yes I guess so, however I wanted a view of schiesbn on this (he should be available next week), before testing my skills on writing tests for the sharing mess |
9053fb8 to
8bb1215
Compare
|
@schiesbn @nickvergessen Is this the way to go? If yes: it needs unit tests ;) |
|
@MorrisJobke just discussed it with @nickvergessen. He will add the unit tests. |
Previously the mount name was checked for uniqueness prior to inserting the share. This caused problems, when two shares with the same name where done or folder, mount point, local share with the same name was done, between sending and accepting of the remote share
8bb1215 to
8ebb198
Compare
|
Added some basic unit tests for @MorrisJobke @schiesbn ready for review again |
There was a problem hiding this comment.
I changed this method, so I can get all shares in the tests, without having to go through the mount logic.
|
The inspection completed: 1 new issues, 10 updated code elements |
|
Refer to this link for build results (access rights to CI server needed): |
|
Tested and works 👍 |
…share "Integrity constraint violation" when sharing the same item twice with the same user
|
Reviewed and tested it together with Morris 👍 |
|
Btw, I just realized on another backport, that we didn't backport this one. I think we should? @schiesbn @MorrisJobke |
The problem is, we try to create the same mount point twice. This PR prevents the SQL error that was triggered previously:
HOWEVER, this means, that 2 people can NOT share a folder
test/with the same person, until that person accepted/denied one of those shares. The problem is, that the(\d+)solution only considers existing files. [guessing from here on] But until the user accepts the share, the mount point does not exist and therefor the(\d+)is not increased.This also leads to the assumption, that if the user creates a folder with the same name, or receives a local share with the same name, prior to accepting the share, 🙈 things will happen?!
Unluckily @schiesbn is not available atm, so I don't know who can help here? @PVince81 @DeepDiver1975 @icewind1991 ?
Broken Scenarios
Local folder
Local share
folder2/folder1from user1 to user2 with a local shareMount point
Mount point