Merge pull request #456 from owncloud/fix_new_from_url

Fix new from url
This commit is contained in:
blizzz 2012-11-26 05:24:58 -08:00
commit 410d798e98
3 changed files with 15 additions and 5 deletions

View File

@ -65,6 +65,7 @@ if($source) {
$target=$dir.'/'.$filename; $target=$dir.'/'.$filename;
$result=OC_Filesystem::file_put_contents($target, $sourceStream); $result=OC_Filesystem::file_put_contents($target, $sourceStream);
if($result) { if($result) {
$target = OC_Filesystem::normalizePath($target);
$meta = OC_FileCache::get($target); $meta = OC_FileCache::get($target);
$mime=$meta['mimetype']; $mime=$meta['mimetype'];
$id = OC_FileCache::getId($target); $id = OC_FileCache::getId($target);

View File

@ -211,7 +211,7 @@ $(document).ready(function() {
$(document).bind('drop dragover', function (e) { $(document).bind('drop dragover', function (e) {
e.preventDefault(); // prevent browser from doing anything, if file isn't dropped in dropZone e.preventDefault(); // prevent browser from doing anything, if file isn't dropped in dropZone
}); });
if ( document.getElementById("data-upload-form") ) { if ( document.getElementById("data-upload-form") ) {
$(function() { $(function() {
$('.file_upload_start').fileupload({ $('.file_upload_start').fileupload({
@ -891,7 +891,7 @@ function getMimeIcon(mime, ready){
if(getMimeIcon.cache[mime]){ if(getMimeIcon.cache[mime]){
ready(getMimeIcon.cache[mime]); ready(getMimeIcon.cache[mime]);
}else{ }else{
$.get( OC.filePath('files','ajax','mimeicon.php')+'?mime='+mime, function(path){ $.get( OC.filePath('files','ajax','mimeicon.php')+'&mime='+mime, function(path){
getMimeIcon.cache[mime]=path; getMimeIcon.cache[mime]=path;
ready(getMimeIcon.cache[mime]); ready(getMimeIcon.cache[mime]);
}); });

View File

@ -42,7 +42,11 @@ OC.EventSource=function(src,data){
} }
dataStr+='requesttoken='+OC.Request.Token; dataStr+='requesttoken='+OC.Request.Token;
if(!this.useFallBack && typeof EventSource !='undefined'){ if(!this.useFallBack && typeof EventSource !='undefined'){
this.source=new EventSource(src+'?'+dataStr); var joinChar = '&';
if(src.indexOf('?') == -1) {
joinChar = '?';
}
this.source=new EventSource(src+joinChar+dataStr);
this.source.onmessage=function(e){ this.source.onmessage=function(e){
for(var i=0;i<this.typelessListeners.length;i++){ for(var i=0;i<this.typelessListeners.length;i++){
this.typelessListeners[i](JSON.parse(e.data)); this.typelessListeners[i](JSON.parse(e.data));
@ -54,7 +58,12 @@ OC.EventSource=function(src,data){
this.iframe=$('<iframe/>'); this.iframe=$('<iframe/>');
this.iframe.attr('id',iframeId); this.iframe.attr('id',iframeId);
this.iframe.hide(); this.iframe.hide();
this.iframe.attr('src',src+'?fallback=true&fallback_id='+OC.EventSource.iframeCount+'&'+dataStr);
var joinChar = '&';
if(src.indexOf('?') == -1) {
joinChar = '?';
}
this.iframe.attr('src',src+joinChar+'fallback=true&fallback_id='+OC.EventSource.iframeCount+'&'+dataStr);
$('body').append(this.iframe); $('body').append(this.iframe);
this.useFallBack=true; this.useFallBack=true;
OC.EventSource.iframeCount++ OC.EventSource.iframeCount++
@ -90,7 +99,7 @@ OC.EventSource.prototype={
lastLength:0,//for fallback lastLength:0,//for fallback
listen:function(type,callback){ listen:function(type,callback){
if(callback && callback.call){ if(callback && callback.call){
if(type){ if(type){
if(this.useFallBack){ if(this.useFallBack){
if(!this.listeners[type]){ if(!this.listeners[type]){