Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
our_own_cloud_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
6ee78af7
Commit
6ee78af7
authored
Mar 29, 2017
by
Vincent Petry
Committed by
GitHub
Mar 29, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #27269 from owncloud/upload_filter_issue7496_backend
#7496 Don`t allow upload of files with extension .part
parents
ff126a53
67994452
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
lib/private/legacy/util.php
lib/private/legacy/util.php
+6
-0
tests/lib/UtilTest.php
tests/lib/UtilTest.php
+10
-0
No files found.
lib/private/legacy/util.php
View file @
6ee78af7
...
...
@@ -1402,6 +1402,12 @@ class OC_Util {
if
(
\
OC\Files\Filesystem
::
isIgnoredDir
(
$trimmed
))
{
return
false
;
}
// detect part files
if
(
preg_match
(
'/'
.
\
OCP\Files\FileInfo
::
BLACKLIST_FILES_REGEX
.
'/'
,
$trimmed
)
!==
0
)
{
return
false
;
}
foreach
(
str_split
(
$trimmed
)
as
$char
)
{
if
(
strpos
(
\
OCP\Constants
::
FILENAME_INVALID_CHARS
,
$char
)
!==
false
)
{
return
false
;
...
...
tests/lib/UtilTest.php
View file @
6ee78af7
...
...
@@ -10,6 +10,9 @@ namespace Test;
use
OC_Util
;
/**
* @group DB
*/
class
UtilTest
extends
\
Test\TestCase
{
public
function
testGetVersion
()
{
$version
=
\
OCP\Util
::
getVersion
();
...
...
@@ -234,6 +237,13 @@ class UtilTest extends \Test\TestCase {
[
'.. '
,
false
],
[
'. '
,
false
],
[
' .'
,
false
],
// part files not allowed
[
'.part'
,
false
],
[
'notallowed.part'
,
false
],
[
'neither.filepart'
,
false
],
// part in the middle is ok
[
'super movie part one.mkv'
,
true
],
[
'super.movie.part.mkv'
,
true
],
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment