Skip to content
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

fix(MediaFiles): return missing 'lastModified' and 'end' attributes #195

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

ath0mas
Copy link
Contributor

@ath0mas ath0mas commented Oct 18, 2020

Platforms affected

www

Motivation and Context

Returned MediaFiles objects for captured media are missing lastModified (null) and end (0).

Description

The helpers.wrapMediaFiles method is using the MediaFile empty constructor, and attributes are set afterward.
But given MediaFile constructor is simply calling its parent cordova-plugin-file.File constructor, we can understand that some File attributes will never be redefined properly.

Directly calling the constructor with all the params values resolves this problem in a clean manner.

Testing

Returned MediaFiles objects now have correct lastModified === lastModifiedDate, and end === size.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@erisu erisu changed the title Fix returned MediaFiles for missing 'lastModified' and 'end' attributes fix(MediaFiles): return missing 'lastModified' and 'end' attributes Jul 25, 2023
See cordova-plugin-file.File constructor for previously missing attributes, like 'lastModified' and 'end'.
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes LGTM

@erisu erisu merged commit 306eb8b into apache:master Jul 31, 2023
6 of 11 checks passed
@ath0mas ath0mas deleted the fix/partial-mediafiles branch July 31, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants