Skip to content
Merged
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
10 changes: 7 additions & 3 deletions apps/dav/lib/Connector/Sabre/ZipFolderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,18 @@ public function handleDownload(Request $request, Response $response): ?bool {
$content[] = $child->getNode();
}

$archiveName = 'download';
$archiveName = $folder->getName();
if (count(explode('/', trim($folder->getPath(), '/'), 3)) === 2) {
// this is a download of the root folder
$archiveName = 'download';
}

$rootPath = $folder->getPath();
if (empty($files)) {
// We download the full folder so keep it in the tree
$rootPath = dirname($folder->getPath());
// Full folder is loaded to rename the archive to the folder name
$archiveName = $folder->getName();
}

$streamer = new Streamer($tarRequest, -1, count($content), $this->timezoneFactory);
$streamer->sendHeaders($archiveName);
// For full folder downloads we also add the folder itself to the archive
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/files_sharing/public-share/PublicShareUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function adjustSharePermission(): void {
*/
export function setupPublicShare(shareName = 'shared'): Cypress.Chainable<string> {

return cy.task('getVariable', { key: 'public-share-data' })
return cy.task('getVariable', { key: `public-share-data--${shareName}` })
.then((data) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { dataSnapshot, shareUrl } = data as any || {}
Expand All @@ -183,7 +183,7 @@ export function setupPublicShare(shareName = 'shared'): Cypress.Chainable<string
shareData.dataSnapshot = snapshot
}),
)
.then(() => cy.task('setVariable', { key: 'public-share-data', value: shareData }))
.then(() => cy.task('setVariable', { key: `public-share-data--${shareName}`, value: shareData }))
.then(() => cy.log(`Public share setup, URL: ${shareData.shareUrl}`))
.then(() => cy.wrap(defaultShareContext.url))
}
Expand Down
6 changes: 4 additions & 2 deletions cypress/e2e/files_sharing/public-share/download.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ describe('files_sharing: Public share - downloading files', { testIsolation: tru
})

describe('folder share', () => {
before(() => setupPublicShare())
const shareName = 'a-folder-share'

before(() => setupPublicShare(shareName))

deleteDownloadsFolderBeforeEach()

Expand All @@ -72,7 +74,7 @@ describe('files_sharing: Public share - downloading files', { testIsolation: tru

// check a file is downloaded
const downloadsFolder = Cypress.config('downloadsFolder')
cy.readFile(`${downloadsFolder}/download.zip`, null, { timeout: 15000 })
cy.readFile(`${downloadsFolder}/${shareName}.zip`, null, { timeout: 15000 })
.should('exist')
.and('have.length.gt', 30)
// Check all files are included
Expand Down
Loading