Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
a12e16e9
Commit
a12e16e9
authored
10 years ago
by
Joas Schilling
Browse files
Options
Downloads
Patches
Plain Diff
Check whether the file id is valid, before using it to delete the previews
parent
9f5433c0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/preview.php
+10
-9
10 additions, 9 deletions
lib/private/preview.php
with
10 additions
and
9 deletions
lib/private/preview.php
+
10
−
9
View file @
a12e16e9
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
namespace
OC
;
namespace
OC
;
use
OC\Preview\Provider
;
use
OC\Preview\Provider
;
use
OCP\Files\FileInfo
;
use
OCP\Files\NotFoundException
;
use
OCP\Files\NotFoundException
;
class
Preview
{
class
Preview
{
...
@@ -327,21 +328,21 @@ class Preview {
...
@@ -327,21 +328,21 @@ class Preview {
* deletes all previews of a file
* deletes all previews of a file
*/
*/
public
function
deleteAllPreviews
()
{
public
function
deleteAllPreviews
()
{
$file
=
$this
->
getFile
();
$fileInfo
=
$this
->
getFileInfo
(
$file
);
$toDelete
=
$this
->
getChildren
();
$toDelete
=
$this
->
getChildren
();
$toDelete
[]
=
$
f
ileInfo
;
$toDelete
[]
=
$
this
->
getF
ileInfo
()
;
foreach
(
$toDelete
as
$delete
)
{
foreach
(
$toDelete
as
$delete
)
{
if
(
$delete
!==
null
&&
$delete
!==
false
)
{
if
(
$delete
instanceof
FileInfo
)
{
/** @var \OCP\Files\FileInfo $delete */
/** @var \OCP\Files\FileInfo $delete */
$fileId
=
$delete
->
getId
();
$fileId
=
$delete
->
getId
();
$previewPath
=
$this
->
getPreviewPath
(
$fileId
);
// getId() might return null, e.g. when the file is a
$this
->
userView
->
deleteAll
(
$previewPath
);
// .ocTransferId*.part file from chunked file upload.
$this
->
userView
->
rmdir
(
$previewPath
);
if
(
!
empty
(
$fileId
))
{
$previewPath
=
$this
->
getPreviewPath
(
$fileId
);
$this
->
userView
->
deleteAll
(
$previewPath
);
$this
->
userView
->
rmdir
(
$previewPath
);
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment