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

Fix public shared folder page when quota includes external storages #28911

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/files_sharing/lib/Controller/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,13 @@ public function showShare($path = ''): TemplateResponse {

$shareTmpl['dir'] = $shareNode->getRelativePath($folderNode->getPath());

// In some cases (for example, when quota includes the external
// storages) the filesystem needs to be mounted to be able to check
// the free space.
/* FIXME: We should do this all nicely in OCP */
OC_Util::tearDownFS();
OC_Util::setupFS($share->getShareOwner());
Comment on lines +410 to +411
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this might have some performance implications. So probably @icewind1991 should have a look when he is back from vacation.


/*
* The OC_Util methods require a view. This just uses the node API
*/
Expand Down
17 changes: 17 additions & 0 deletions build/integration/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,23 @@ public function userAcceptsLastShare(string $user) {
$this->theHTTPStatusCodeShouldBe('200');
}

/**
* @Then /^public page of last share can be shown$/
*/
public function publicPageOfLastShareCanBeShown() {
if (count($this->lastShareData->data->element) > 0) {
$token = $this->lastShareData->data[0]->token;
} else {
$token = $this->lastShareData->data->token;
}

$fullUrl = substr($this->baseUrl, 0, -4) . "index.php/s/" . $token;

$client = new Client();
$this->response = $client->get($fullUrl);
Assert::assertEquals(200, $this->response->getStatusCode());
}

/**
* @Then /^last link share can be downloaded$/
*/
Expand Down
7 changes: 7 additions & 0 deletions build/integration/features/bootstrap/SharingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,11 @@ protected function resetAppConfigs() {
$this->deleteServerConfig('core', 'shareapi_expire_after_n_days');
$this->deleteServerConfig('core', 'link_defaultExpDays');
}

/**
* @AfterScenario
*/
public function resetSystemConfigs() {
$this->invokingTheCommand('config:system:delete quota_include_external_storage');
}
}
11 changes: 11 additions & 0 deletions build/integration/sharing_features/sharing-v1.feature
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,17 @@ Feature: sharing
| url | AN_URL |
| mimetype | httpd/unix-directory |

Scenario: Creating a new public shared folder by user with quota but without external storages and show the share
Given user "user0" exists
And As an "admin"
And user "user0" has a quota of "10 MB"
And invoking occ with "config:system:set quota_include_external_storage --value=true --type boolean"
And As an "user0"
When creating a share with
| path | FOLDER |
| shareType | 3 |
Then public page of last share can be shown

Scenario: Creating a new share of a file with default permissions
Given user "user0" exists
And user "user1" exists
Expand Down