Use write permission when possible #1488
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an issue where the same file is present in the users files multiple times, e.g. through different shares where on one the user has read only and on the other write permissions. As we currently only track file opening by file id there is no way to determine in the text app session which of the file mounts should be used so this patch makes sure we always use the widest permissions when trying to access the file.
The ideal solution would probably be to track the file open path for every session but that would of course then break editing sessions where the file is moved around, so i felt like this approach is the more feasible option, but I'm open for suggestions if anyone has better ideas to solve this.
Note this is also an issue for Collabora/ONLYOFFICE or any other app or code that attempts to get a file by id, so we might have plenty of other places where this is happening as just using the first element seems quite common in the existing codebase.