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

Allow writing empty content to new file #22237

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

georgehrke
Copy link
Member

ISimpleFolder::newFile('file.txt', '') will fail on master, because file_put_contents returns the amount of bytes written, which for '' is 0. Hence we need a strict false check.

$result = $this->view->file_put_contents($fullPath, $content);

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
@georgehrke georgehrke added the 3. to review Waiting for reviews label Aug 13, 2020
@faily-bot
Copy link

faily-bot bot commented Aug 13, 2020

🤖 beep boop beep 🤖

Here are the logs for the failed build:

Status of 31763: failure

mysql8.0-php7.2

Show full log
There were 2 warnings:

1) Test\Files\ViewTest::testRenameFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static

2) Test\Files\ViewTest::testCopyFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static

--

There was 1 failure:

1) Test\Files\ObjectStore\ObjectStoreStorageTest::testCopy with data set #7 ('/single ' quote.txt', '/tar'get.txt')
Expected /tar'get.txt to be a copy of /drone/src/tests/data/lorem.txt
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n
-Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n
-Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n
-Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
+''

/drone/src/tests/lib/Files/Storage/Storage.php:222
/drone/src/tests/lib/Files/Storage/Storage.php:235

acceptance-app-files

  • tests/acceptance/features/app-files.feature:262
Show full log
  Scenario: unmarking a file as favorite causes the file list to be sorted again                          # /drone/src/tests/acceptance/features/app-files.feature:262
    Given I am logged in                                                                                  # LoginPageContext::iAmLoggedIn()
    And I create a new folder named "A name alphabetically lower than welcome.txt"                        # FileListContext::iCreateANewFolderNamed()
    And I see that "A name alphabetically lower than welcome.txt" precedes "welcome.txt" in the file list # FileListContext::iSeeThatPrecedesInTheFileList()
    And I close the details view                                                                          # FilesAppContext::iCloseTheDetailsView()
    And I see that the details view is closed                                                             # FilesAppContext::iSeeThatTheDetailsViewIsClosed()
    And I mark "welcome.txt" as favorite                                                                  # FileListContext::iMarkAsFavorite()
    And I see that "welcome.txt" is marked as favorite                                                    # FileListContext::iSeeThatIsMarkedAsFavorite()
    And I see that "welcome.txt" precedes "A name alphabetically lower than welcome.txt" in the file list # FileListContext::iSeeThatPrecedesInTheFileList()
    When I unmark "welcome.txt" as favorite                                                               # FileListContext::iUnmarkAsFavorite()
    Then I see that "welcome.txt" is not marked as favorite                                               # FileListContext::iSeeThatIsNotMarkedAsFavorite()
      Not favorited state icon for file welcome.txt in file list could not be found after 100 seconds (NoSuchElementException)
    And I see that "A name alphabetically lower than welcome.txt" precedes "welcome.txt" in the file list # FileListContext::iSeeThatPrecedesInTheFileList()

@kesselb
Copy link
Contributor

kesselb commented Aug 13, 2020

FYI: #21386

@georgehrke
Copy link
Member Author

FYI: #21386

Thanks, wasn't aware of that ticket.

@georgehrke georgehrke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Aug 14, 2020
@nickvergessen
Copy link
Member

So that is why newly uploaded avatars are stored as generated once again …

@rullzer rullzer merged commit af3a59f into master Aug 20, 2020
@rullzer rullzer deleted the bugfix/noid/allow_putContent_empty_string branch August 20, 2020 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants