-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename directory error #33
Comments
Hmm, I can't reproduce it in any way. Where did you get that error? Which the connector was? |
I'm only getting this error on the newest master branch, using my nodejs connector. But the connector isn't even getting a request. I'll step through the code today and see I can figure out where it's going wrong :) |
Ok, I figured out what is causing this. The function // Test if path is dir
var isFile = function(path) {
return path.charAt(path.length - 1) != '/';
}; on line 407. When you normalize a path in nodejs and it is a directory, it will not include a trailing slash. I think there is a much better way to deal with this since we are also passing back a 'File Type'. I would write a new function called _$.isFile and take the entire object, first checking if file type = "dir", and if not, checking for a trailing slash to be robust. If the api errors and sends a path with an incorrect file type, it will still work in this case. This function is used 12 times in filemanager.js, so that is 12 places for this bug to pop up. I would start with something like this _$.isFile = function(file) {
if (file["File Type"] === "dir") {
return false;
} else {
return (file["Path"].charAt(file["Path"].length - 1) !== "/");
}
} |
This is not a solution and I'm not going to change |
But we are able to extend conditions like |
Anyway you should add trailing slash for each folder path in your connector |
The new API specifies that trailing slash is mandatory for folders. |
When trying to rename a Directory it is giving the following error.
File type is not allowed.
Only following files are allowed: jpg, jpe, jpeg, gif, png, svg, txt, pdf, odp, ods, odt, rtf, doc, docx, xls, xlsx, ppt, pptx, csv, ogv, avi, mkv, mp4, webm, m4v, ogg, mp3, wav, zip, rar.
The text was updated successfully, but these errors were encountered: