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
ae2304f2
Commit
ae2304f2
authored
9 years ago
by
Thomas Müller
Browse files
Options
Downloads
Plain Diff
Merge pull request #22405 from owncloud/gdrive-mimetype-and-office-fixes
Fix GDrive handling of office files
parents
f6e61a29
075dd54f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_external/lib/google.php
+13
-4
13 additions, 4 deletions
apps/files_external/lib/google.php
with
13 additions
and
4 deletions
apps/files_external/lib/google.php
+
13
−
4
View file @
ae2304f2
...
@@ -264,7 +264,7 @@ class Google extends \OC\Files\Storage\Common {
...
@@ -264,7 +264,7 @@ class Google extends \OC\Files\Storage\Common {
foreach
(
$children
->
getItems
()
as
$child
)
{
foreach
(
$children
->
getItems
()
as
$child
)
{
$name
=
$child
->
getTitle
();
$name
=
$child
->
getTitle
();
// Check if this is a Google Doc i.e. no extension in name
// Check if this is a Google Doc i.e. no extension in name
if
(
$child
->
getFileExtension
()
===
''
if
(
empty
(
$child
->
getFileExtension
()
)
&&
$child
->
getMimeType
()
!==
self
::
FOLDER
&&
$child
->
getMimeType
()
!==
self
::
FOLDER
)
{
)
{
$name
.
=
'.'
.
$this
->
getGoogleDocExtension
(
$child
->
getMimeType
());
$name
.
=
'.'
.
$this
->
getGoogleDocExtension
(
$child
->
getMimeType
());
...
@@ -368,8 +368,14 @@ class Google extends \OC\Files\Storage\Common {
...
@@ -368,8 +368,14 @@ class Google extends \OC\Files\Storage\Common {
public
function
rename
(
$path1
,
$path2
)
{
public
function
rename
(
$path1
,
$path2
)
{
$file
=
$this
->
getDriveFile
(
$path1
);
$file
=
$this
->
getDriveFile
(
$path1
);
if
(
$file
)
{
if
(
$file
)
{
$newFile
=
$this
->
getDriveFile
(
$path2
);
if
(
dirname
(
$path1
)
===
dirname
(
$path2
))
{
if
(
dirname
(
$path1
)
===
dirname
(
$path2
))
{
$file
->
setTitle
(
basename
((
$path2
)));
if
(
$newFile
)
{
// rename to the name of the target file, could be an office file without extension
$file
->
setTitle
(
$newFile
->
getTitle
());
}
else
{
$file
->
setTitle
(
basename
((
$path2
)));
}
}
else
{
}
else
{
// Change file parent
// Change file parent
$parentFolder2
=
$this
->
getDriveFile
(
dirname
(
$path2
));
$parentFolder2
=
$this
->
getDriveFile
(
dirname
(
$path2
));
...
@@ -394,8 +400,11 @@ class Google extends \OC\Files\Storage\Common {
...
@@ -394,8 +400,11 @@ class Google extends \OC\Files\Storage\Common {
if
(
$result
)
{
if
(
$result
)
{
$this
->
setDriveFile
(
$path1
,
false
);
$this
->
setDriveFile
(
$path1
,
false
);
$this
->
setDriveFile
(
$path2
,
$result
);
$this
->
setDriveFile
(
$path2
,
$result
);
if
(
$oldfile
)
{
if
(
$oldfile
&&
$newFile
)
{
$this
->
service
->
files
->
delete
(
$oldfile
->
getId
());
// only delete if they have a different id (same id can happen for part files)
if
(
$newFile
->
getId
()
!==
$oldfile
->
getId
())
{
$this
->
service
->
files
->
delete
(
$oldfile
->
getId
());
}
}
}
}
}
return
(
bool
)
$result
;
return
(
bool
)
$result
;
...
...
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