aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/file-upload.js15
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--apps/files/js/sidebarpreviewmanager.js15
-rw-r--r--apps/files/js/sidebarpreviewtext.js6
4 files changed, 27 insertions, 11 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 8bcaa2e24aa..25136d042a9 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -130,6 +130,16 @@ OC.FileUpload.prototype = {
},
/**
+ * Get full path for the target file,
+ * including relative path and file name.
+ *
+ * @return {String} full path
+ */
+ getFullFilePath: function() {
+ return OC.joinPaths(this.getFullPath(), this.getFile().name);
+ },
+
+ /**
* Returns conflict resolution mode.
*
* @return {int} conflict mode
@@ -151,7 +161,7 @@ OC.FileUpload.prototype = {
/**
* Returns whether the upload is in progress
*
- * @return {bool}
+ * @return {boolean}
*/
isPending: function() {
return this.data.state() === 'pending';
@@ -508,9 +518,10 @@ OC.Uploader.prototype = _.extend({
return;
}
// retrieve more info about this file
- this.filesClient.getFileInfo(fileUpload.getFullPath()).then(function(status, fileInfo) {
+ this.filesClient.getFileInfo(fileUpload.getFullFilePath()).then(function(status, fileInfo) {
var original = fileInfo;
var replacement = file;
+ original.directory = original.path;
OC.dialogs.fileexists(fileUpload, original, replacement, self);
});
},
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index fb0439114ed..a8daeadfd26 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1638,7 +1638,7 @@
return false;
}
- if (status === 404 || status === 405) {
+ if (status === 400 || status === 404 || status === 405) {
// go back home
this.changeDirectory('/');
return false;
diff --git a/apps/files/js/sidebarpreviewmanager.js b/apps/files/js/sidebarpreviewmanager.js
index 3d540119189..2cf4248897a 100644
--- a/apps/files/js/sidebarpreviewmanager.js
+++ b/apps/files/js/sidebarpreviewmanager.js
@@ -20,19 +20,28 @@
this._previewHandlers[mime] = handler;
},
- getPreviewHandler: function (mime) {
+ getMimeTypePreviewHandler: function(mime) {
var mimePart = mime.split('/').shift();
if (this._previewHandlers[mime]) {
return this._previewHandlers[mime];
- } else if(this._previewHandlers[mimePart]) {
+ } else if (this._previewHandlers[mimePart]) {
return this._previewHandlers[mimePart];
} else {
+ return null;
+ }
+ },
+
+ getPreviewHandler: function (mime) {
+ var mimetypeHandler = this.getMimeTypePreviewHandler(mime);
+ if (mimetypeHandler) {
+ return mimetypeHandler;
+ } else {
return this.fallbackPreview.bind(this);
}
},
loadPreview: function (model, $thumbnailDiv, $thumbnailContainer) {
- if (model.get('hasPreview') === false) {
+ if (model.get('hasPreview') === false && this.getMimeTypePreviewHandler(model.get('mimetype')) === null) {
var mimeIcon = OC.MimeType.getIconUrl(model.get('mimetype'));
$thumbnailDiv.removeClass('icon-loading icon-32');
$thumbnailContainer.removeClass('image'); //fall back to regular view
diff --git a/apps/files/js/sidebarpreviewtext.js b/apps/files/js/sidebarpreviewtext.js
index 5af17bd5551..a19a349701b 100644
--- a/apps/files/js/sidebarpreviewtext.js
+++ b/apps/files/js/sidebarpreviewtext.js
@@ -18,7 +18,6 @@
},
handlePreview: function (model, $thumbnailDiv, $thumbnailContainer, fallback) {
- console.log(model);
var previewWidth = $thumbnailContainer.parent().width() + 50; // 50px for negative margins
var previewHeight = previewWidth / (16 / 9);
@@ -36,10 +35,7 @@
},
getFileContent: function (path) {
- console.log(path);
- var url = OC.linkToRemoteBase('files' + path);
- console.log(url);
- return $.get(url);
+ return $.get(OC.linkToRemoteBase('files' + path));
}
};