-
Notifications
You must be signed in to change notification settings - Fork 757
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
Update Metadata.js #39
Conversation
File was not updated correct after changing "modificationTime" to "lastModifiedDate"
Not sure this is correct. The spec says it should be "modificationTime": http://dev.w3.org/2009/dap/file-system/pub/FileSystem/ The js function that uses Metadata: cordova-plugin-file/www/Entry.js Lines 65 to 75 in 21e1196
On iOS, it is modificationTime:
But, on Android it's lastModifiedDate:
So I think this is a bug in Android. |
Also, Android has all these extra properties that are not part of the spec: cordova-plugin-file/src/android/LocalFilesystem.java Lines 294 to 296 in 757e692
|
What about the "com.apple.MobileBackup"? I'm trying to set it but neither the success or the fail callback function is being called. |
@alessandronunes this was a bug in the File plugin. It should be fixed in the dev branch, or wait an hour or so when the new plugin version gets published. |
Woops, it just happened - plugins are released! http://cordova.apache.org/news/2014/04/23/plugins.release.html |
Thanks Shaz! Do you know when, usually, Phonegap gets updated after this? |
For Plugins, we aim for a weekly release, however prior to this, our last one was over 5 weeks ago I think. For the core platforms, we used to aim for a monthly release, but now it is indeterminate. |
Thanks again. Good job! |
It looks like the mobilespec test for this just checked that
So it never failed. :( Definitely a bug in Android; I'll fix that for the next release. |
In File.js always "lastModifiedDate" is used, |
Hmm File.js represents the File interface in the File API spec: http://www.w3.org/TR/FileAPI/#file and it does specify lastModifiedDate, which is correct. FileEntry.file is correct, it should return a File object, so that's fine -- but it has a bug in it in how it constructs the File object. Since it is calling the getMetadata function, the call to get the date should be f.modificationTime instead of f.lastModifiedDate (since the returned object to the successcallback is a Metadata object): cordova-plugin-file/www/FileEntry.js Line 71 in 767e2c5
|
I've created CB-6922 for this -- it was certainly a problem in Android. The trouble, as Shaz identified, is that both the File API and the FileEntry API have a method to get metadata for a file, and they use inconsistent names for the timestamp. I've committed a different fix, which just makes use of getFileMetadata for both functions (on all platforms) and changes the key names in JavaScript before instantiating the Metadata object. This should ensure consistent behaviour across all platforms. |
This fix has been committed, and the tests are ensuring that the correct keys appear in the callbacks. You can close this pull request, I think. |
File was not updated correct after changing "modificationTime" to "lastModifiedDate"