X Tutup
Skip to content

[full-ci] Allow renaming two files with the same name but different paths#39315

Merged
phil-davis merged 4 commits intomasterfrom
issues/20722
Oct 6, 2021
Merged

[full-ci] Allow renaming two files with the same name but different paths#39315
phil-davis merged 4 commits intomasterfrom
issues/20722

Conversation

@AlexAndBear
Copy link

@AlexAndBear AlexAndBear commented Oct 1, 2021

Description

Bugfix: Allow renaming two files with the same name but different paths

With this change, we allow renaming a file to an existing file name,
when the path differs.
This happens for example when the user creates the file
'/mydirname/text.txt' and '/mytext.txt' then mark both as favorite.

Related Issue

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@AlexAndBear AlexAndBear changed the title add option path to inList func Allow renaming two files with the same name but different paths Oct 1, 2021
@AlexAndBear
Copy link
Author

@phil-davis should we add acceptance tests for #20722 ?

@owncloud owncloud deleted a comment from ownclouders Oct 1, 2021
@owncloud owncloud deleted a comment from ownclouders Oct 1, 2021
@owncloud owncloud deleted a comment from ownclouders Oct 1, 2021
@owncloud owncloud deleted a comment from ownclouders Oct 1, 2021
@owncloud owncloud deleted a comment from ownclouders Oct 1, 2021
@owncloud owncloud deleted a comment from ownclouders Oct 1, 2021
@owncloud owncloud deleted a comment from ownclouders Oct 1, 2021
@AlexAndBear AlexAndBear marked this pull request as ready for review October 1, 2021 12:11
@owncloud owncloud deleted a comment from update-docs bot Oct 1, 2021
@AlexAndBear AlexAndBear force-pushed the issues/20722 branch 2 times, most recently from 3cb0726 to 4f5a500 Compare October 1, 2021 13:50
@ownclouders
Copy link
Contributor

💥 Acceptance tests pipeline webUISharingPublic2-chrome-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/32824/145/1

@owncloud owncloud deleted a comment from ownclouders Oct 1, 2021
@ownclouders
Copy link
Contributor

💥 Acceptance tests pipeline webUISharingPublic2-chrome-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/32825/145/1

@phil-davis
Copy link
Contributor

Note: there is another scenario, which is a different existing feature:

  • abc.txt and def.txt in the root folder
  • favorite abc.txt
  • on the Favorites page, try to rename abc.txt to def.txt
  • it lets you try, but then a notification is displayed "The name "def.txt" is already used in the folder "/". Please choose a different name."

It would be nice if the on-the-fly rename code in the JavaScript could "understand" that the proposed name is already used. But that would require more real-time code that checks with the server on every character as it is typed, or when starting the "Rename" input, the JavaScript would have to get a list of all the files in the foldder of that item, so that it could check as the user types. Maybe not feasible.

@phil-davis
Copy link
Contributor

Rebased to get fresh CI.

@ownclouders
Copy link
Contributor

💥 Acceptance tests pipeline webUISharingPublic2-chrome-mariadb10.2-php7.4 failed. The build has been cancelled.

https://drone.owncloud.com/owncloud/core/32848/145/1

@phil-davis phil-davis changed the title Allow renaming two files with the same name but different paths [full-ci] Allow renaming two files with the same name but different paths Oct 4, 2021
@phil-davis
Copy link
Contributor

@janackermann I sorted out the shareByPublicLink test scenario that originally had a wrong Then step that actually did not check the right thing, and did not fail. But the scenario fails now because when I rename a resource on the "Shared by link" page, the hover text for the actual location of the resource does not get updated. See the screen-shot where I renamed "test" to "wwwwww" but the hover-text was still "ttt/test" (that folder is a sub-folder of folder "ttt")
hover-text-does-not-match-rename

There is the same problem on the "Shared with others" page.

If you can sort out the hover-text being updated (data-original-title) on rename, then the test scenario should pass.

The "Favorites" page does not seem to have any hover-text to give the user a clue where the resource really is. When I have 2 files with the same name on the Favorites page, I don't know how I can know which file is from which folder. If we can have some similar way for the user to know which resource is from where, then we can make test scenarios.

@AlexAndBear
Copy link
Author

@phil-davis Thx, will take care

@AlexAndBear
Copy link
Author

@phil-davis

If we can have some similar way for the user to know which resource is from where, then we can make test scenarios.

this has been introduced just know, do you want to adjust the tests?

@phil-davis
Copy link
Contributor

I will come banck when CI is done, and look what happens and then see what other tests can be added.

@AlexAndBear
Copy link
Author

@phil-davis friendly ping =)

@phil-davis phil-davis self-requested a review October 6, 2021 09:46
Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I tried various renaming to matching and not matching names on the Favorites page and the Shared by Link page and it works fine. Tests pass.

I found one little thing in the changelog!

@phil-davis phil-davis self-requested a review October 6, 2021 10:14
Co-authored-by: Phil Davis <phil@jankaritech.com>
Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now - works.
@jvillafanez please review again

@phil-davis
Copy link
Contributor

https://drone.owncloud.com/owncloud/core/32907/31/8

+ phpdbg -d memory_limit=6G -rr ../lib/composer/bin/phpunit --configuration phpunit-autotest-external.xml --coverage-clover output/coverage/autotest-external-clover-sqlite-sftp.xml ../apps/files_external/tests/Storage/SftpTest.php
[Welcome to phpdbg, the interactive PHP debugger, v7.4.23]
To get help using phpdbg type "help" and press enter
[Please report bugs to <http://bugs.php.net/report.php>]
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

Runtime:       PHPDBG 7.4.23
Configuration: phpunit-autotest-external.xml

.................................E............................... 65 / 92 ( 70%)
...........................                                       92 / 92 (100%)

Time: 00:31.609, Memory: 80.63 MB

There was 1 error:

1) OCA\Files_External\Tests\Storage\SftpTest::testMove with data set #7 ('/single ' quote.txt', '/tar'get.txt')
fwrite() expects parameter 1 to be resource, bool given

/drone/src/lib/private/Files/Storage/Common.php:207
/drone/src/tests/lib/Files/Storage/Storage.php:193
/drone/src/tests/lib/Files/Storage/Storage.php:226

ERRORS!
Tests: 92, Assertions: 369, Errors: 1.

That is a strange unit test fail - nothing to do with this PR. I will restart CI.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 6, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

81.0% 81.0% Coverage
0.0% 0.0% Duplication

@phil-davis phil-davis merged commit 029aa73 into master Oct 6, 2021
@delete-merged-branch delete-merged-branch bot deleted the issues/20722 branch October 6, 2021 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in renaming files/folders in shared with pages When I favored two files with same name

5 participants

X Tutup