Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
2b192a75
Commit
2b192a75
authored
12 years ago
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
normalize the path once in upload.php is enough - THX Robin for this hint
parent
7af4cf48
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files/ajax/upload.php
+2
-6
2 additions, 6 deletions
apps/files/ajax/upload.php
lib/filecache.php
+0
-2
0 additions, 2 deletions
lib/filecache.php
with
2 additions
and
8 deletions
apps/files/ajax/upload.php
+
2
−
6
View file @
2b192a75
...
...
@@ -48,15 +48,11 @@ if(strpos($dir, '..') === false) {
$fileCount
=
count
(
$files
[
'name'
]);
for
(
$i
=
0
;
$i
<
$fileCount
;
$i
++
)
{
$target
=
OCP\Files
::
buildNotExistingFileName
(
stripslashes
(
$dir
),
$files
[
'name'
][
$i
]);
// $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder
$target
=
OC_Filesystem
::
normalizePath
(
$target
);
if
(
is_uploaded_file
(
$files
[
'tmp_name'
][
$i
])
and
OC_Filesystem
::
fromTmpFile
(
$files
[
'tmp_name'
][
$i
],
$target
))
{
$meta
=
OC_FileCache
::
get
(
$target
);
$id
=
OC_FileCache
::
getId
(
$target
);
// in case the upload goes to a sub directory getID() returns -1 and $target needs to be normalized
// calling normalizePath() inside getId() causes endless scan.
if
(
$id
==
-
1
)
{
$path
=
OC_Filesystem
::
normalizePath
(
$target
);
$id
=
OC_FileCache
::
getId
(
$path
);
}
$result
[]
=
array
(
"status"
=>
"success"
,
'mime'
=>
$meta
[
'mimetype'
],
'size'
=>
$meta
[
'size'
],
'id'
=>
$id
,
'name'
=>
basename
(
$target
));
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/filecache.php
+
0
−
2
View file @
2b192a75
...
...
@@ -43,8 +43,6 @@ class OC_FileCache{
* - versioned
*/
public
static
function
get
(
$path
,
$root
=
false
)
{
// $path needs to be normalized - this failed within drag'n'drop upload to a subfolder
$path
=
OC_Filesystem
::
normalizePath
(
$path
);
if
(
OC_FileCache_Update
::
hasUpdated
(
$path
,
$root
))
{
if
(
$root
===
false
)
{
//filesystem hooks are only valid for the default root
OC_Hook
::
emit
(
'OC_Filesystem'
,
'post_write'
,
array
(
'path'
=>
$path
));
...
...
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