Skip to content

Commit 2e3d756

Browse files
authored
Merge pull request #1097 from nextcloud/fix/copy_from_storage_null_user
fix(LockWrapper): gracefully handle null user in copyFromStorage()
2 parents 8fb9bc6 + e3bb8ef commit 2e3d756

9 files changed

Lines changed: 50 additions & 51 deletions

File tree

.github/workflows/lint-php-cs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ jobs:
2525

2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929
with:
3030
persist-credentials: false
3131

3232
- name: Get php version
3333
id: versions
34-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
34+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3535

3636
- name: Set up php${{ steps.versions.outputs.php-min }}
37-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
37+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
3838
with:
3939
php-version: ${{ steps.versions.outputs.php-min }}
4040
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

.github/workflows/lint-php.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,35 @@ jobs:
2121
matrix:
2222
runs-on: ubuntu-latest-low
2323
outputs:
24-
php-versions: ${{ steps.versions.outputs.php-versions }}
24+
php-min: ${{ steps.versions.outputs.php-min }}
25+
php-max: ${{ steps.versions.outputs.php-max }}
2526
steps:
2627
- name: Checkout app
27-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2829
with:
2930
persist-credentials: false
3031

3132
- name: Get version matrix
3233
id: versions
33-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
34+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3435

3536
php-lint:
3637
runs-on: ubuntu-latest
3738
needs: matrix
3839
strategy:
3940
matrix:
40-
php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}}
41+
php-versions: ['${{ needs.matrix.outputs.php-min }}', '${{ needs.matrix.outputs.php-max }}']
4142

4243
name: php-lint
4344

4445
steps:
4546
- name: Checkout
46-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
47+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4748
with:
4849
persist-credentials: false
4950

5051
- name: Set up php ${{ matrix.php-versions }}
51-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
52+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
5253
with:
5354
php-version: ${{ matrix.php-versions }}
5455
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

.github/workflows/phpunit-mariadb.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
server-max: ${{ steps.versions.outputs.branches-max-list }}
2626
steps:
2727
- name: Checkout app
28-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929
with:
3030
persist-credentials: false
3131

3232
- name: Get version matrix
3333
id: versions
34-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
34+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3535

3636
changes:
3737
runs-on: ubuntu-latest-low
@@ -43,7 +43,7 @@ jobs:
4343
src: ${{ steps.changes.outputs.src}}
4444

4545
steps:
46-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
46+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
4747
id: changes
4848
continue-on-error: true
4949
with:
@@ -91,21 +91,21 @@ jobs:
9191
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
9292
9393
- name: Checkout server
94-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
94+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9595
with:
9696
persist-credentials: false
9797
submodules: true
9898
repository: nextcloud/server
9999
ref: ${{ matrix.server-versions }}
100100

101101
- name: Checkout app
102-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
102+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
103103
with:
104104
persist-credentials: false
105105
path: apps/${{ env.APP_NAME }}
106106

107107
- name: Set up php ${{ matrix.php-versions }}
108-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
108+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
109109
with:
110110
php-version: ${{ matrix.php-versions }}
111111
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -124,7 +124,7 @@ jobs:
124124
125125
- name: Check composer file existence
126126
id: check_composer
127-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
127+
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0
128128
with:
129129
files: apps/${{ env.APP_NAME }}/composer.json
130130

.github/workflows/phpunit-mysql.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424
matrix: ${{ steps.versions.outputs.sparse-matrix }}
2525
steps:
2626
- name: Checkout app
27-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828
with:
2929
persist-credentials: false
3030

3131
- name: Get version matrix
3232
id: versions
33-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
33+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3434
with:
3535
matrix: '{"mysql-versions": ["8.4"]}'
3636

@@ -44,7 +44,7 @@ jobs:
4444
src: ${{ steps.changes.outputs.src}}
4545

4646
steps:
47-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
47+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
4848
id: changes
4949
continue-on-error: true
5050
with:
@@ -89,21 +89,21 @@ jobs:
8989
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
9090
9191
- name: Checkout server
92-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
92+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9393
with:
9494
persist-credentials: false
9595
submodules: true
9696
repository: nextcloud/server
9797
ref: ${{ matrix.server-versions }}
9898

9999
- name: Checkout app
100-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
100+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
101101
with:
102102
persist-credentials: false
103103
path: apps/${{ env.APP_NAME }}
104104

105105
- name: Set up php ${{ matrix.php-versions }}
106-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
106+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
107107
with:
108108
php-version: ${{ matrix.php-versions }}
109109
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -122,7 +122,7 @@ jobs:
122122
123123
- name: Check composer file existence
124124
id: check_composer
125-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
125+
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0
126126
with:
127127
files: apps/${{ env.APP_NAME }}/composer.json
128128

.github/workflows/phpunit-oci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
server-max: ${{ steps.versions.outputs.branches-max-list }}
2626
steps:
2727
- name: Checkout app
28-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929
with:
3030
persist-credentials: false
3131

3232
- name: Get version matrix
3333
id: versions
34-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
34+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3535

3636
changes:
3737
runs-on: ubuntu-latest-low
@@ -43,7 +43,7 @@ jobs:
4343
src: ${{ steps.changes.outputs.src }}
4444

4545
steps:
46-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
46+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
4747
id: changes
4848
continue-on-error: true
4949
with:
@@ -101,21 +101,21 @@ jobs:
101101
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
102102
103103
- name: Checkout server
104-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
104+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
105105
with:
106106
persist-credentials: false
107107
submodules: true
108108
repository: nextcloud/server
109109
ref: ${{ matrix.server-versions }}
110110

111111
- name: Checkout app
112-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
112+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
113113
with:
114114
persist-credentials: false
115115
path: apps/${{ env.APP_NAME }}
116116

117117
- name: Set up php ${{ matrix.php-versions }}
118-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
118+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
119119
with:
120120
php-version: ${{ matrix.php-versions }}
121121
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -129,7 +129,7 @@ jobs:
129129

130130
- name: Check composer file existence
131131
id: check_composer
132-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
132+
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0
133133
with:
134134
files: apps/${{ env.APP_NAME }}/composer.json
135135

.github/workflows/phpunit-pgsql.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
server-max: ${{ steps.versions.outputs.branches-max-list }}
2626
steps:
2727
- name: Checkout app
28-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929
with:
3030
persist-credentials: false
3131

3232
- name: Get version matrix
3333
id: versions
34-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
34+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3535

3636
changes:
3737
runs-on: ubuntu-latest-low
@@ -43,7 +43,7 @@ jobs:
4343
src: ${{ steps.changes.outputs.src }}
4444

4545
steps:
46-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
46+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
4747
id: changes
4848
continue-on-error: true
4949
with:
@@ -92,21 +92,21 @@ jobs:
9292
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
9393
9494
- name: Checkout server
95-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
95+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9696
with:
9797
persist-credentials: false
9898
submodules: true
9999
repository: nextcloud/server
100100
ref: ${{ matrix.server-versions }}
101101

102102
- name: Checkout app
103-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
103+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104104
with:
105105
persist-credentials: false
106106
path: apps/${{ env.APP_NAME }}
107107

108108
- name: Set up php ${{ matrix.php-versions }}
109-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
109+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
110110
with:
111111
php-version: ${{ matrix.php-versions }}
112112
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -120,7 +120,7 @@ jobs:
120120

121121
- name: Check composer file existence
122122
id: check_composer
123-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
123+
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0
124124
with:
125125
files: apps/${{ env.APP_NAME }}/composer.json
126126

.github/workflows/phpunit-sqlite.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
server-max: ${{ steps.versions.outputs.branches-max-list }}
2626
steps:
2727
- name: Checkout app
28-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929
with:
3030
persist-credentials: false
3131

3232
- name: Get version matrix
3333
id: versions
34-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
34+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3535

3636
changes:
3737
runs-on: ubuntu-latest-low
@@ -43,7 +43,7 @@ jobs:
4343
src: ${{ steps.changes.outputs.src}}
4444

4545
steps:
46-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
46+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
4747
id: changes
4848
continue-on-error: true
4949
with:
@@ -81,21 +81,21 @@ jobs:
8181
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
8282
8383
- name: Checkout server
84-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
84+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8585
with:
8686
persist-credentials: false
8787
submodules: true
8888
repository: nextcloud/server
8989
ref: ${{ matrix.server-versions }}
9090

9191
- name: Checkout app
92-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
92+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9393
with:
9494
persist-credentials: false
9595
path: apps/${{ env.APP_NAME }}
9696

9797
- name: Set up php ${{ matrix.php-versions }}
98-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
98+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
9999
with:
100100
php-version: ${{ matrix.php-versions }}
101101
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -109,7 +109,7 @@ jobs:
109109

110110
- name: Check composer file existence
111111
id: check_composer
112-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
112+
uses: andstor/file-existence-action@558493d6c74bf472d87c84eab196434afc2fa029 # v3.1.0
113113
with:
114114
files: apps/${{ env.APP_NAME }}/composer.json
115115

.github/workflows/psalm.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ jobs:
2424
name: static-psalm-analysis
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828
with:
2929
persist-credentials: false
3030

3131
- name: Get php version
3232
id: versions
33-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
33+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3434

3535
- name: Check enforcement of minimum PHP version ${{ steps.versions.outputs.php-min }} in psalm.xml
3636
run: grep 'phpVersion="${{ steps.versions.outputs.php-min }}' psalm.xml
3737

3838
- name: Set up php${{ steps.versions.outputs.php-available }}
39-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
39+
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1
4040
with:
4141
php-version: ${{ steps.versions.outputs.php-available }}
4242
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
@@ -52,9 +52,6 @@ jobs:
5252
composer remove nextcloud/ocp --dev --no-scripts
5353
composer i
5454
55-
- name: Check for vulnerable PHP dependencies
56-
run: composer require --dev roave/security-advisories:dev-latest
57-
5855
- name: Install nextcloud/ocp
5956
run: composer require --dev nextcloud/ocp:dev-${{ steps.versions.outputs.branches-max }} --ignore-platform-reqs --with-dependencies
6057

lib/Storage/LockWrapper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalP
176176
$cache = $sourceStorage->getCache();
177177
$fileId = $cache->getId($sourceInternalPath);
178178

179-
if ($fileId > 0 && $this->isFileLocked($fileId, $this->userSession->getUser()->getUID(), $lock)) {
179+
$user = $this->userSession->getUser();
180+
if ($fileId > 0 && $this->isFileLocked($fileId, $user?->getUID() || '', $lock)) {
180181
throw new ManuallyLockedException($sourceInternalPath, null, $lock->getToken(), $lock->getOwner(), $lock->getETA());
181182
}
182183

0 commit comments

Comments
 (0)