cordova-plugin-camera icon indicating copy to clipboard operation
cordova-plugin-camera copied to clipboard

fix: DATA_URL is improperly prefixed

Open hazems opened this issue 6 years ago • 1 comments

Platforms affected

All (Android, iOS, OS X, Windows and Browser)

Motivation and Context

When calling navigator.camera.getPicture with destinationType set to Camera.DestinationType.DATA_URL, the success function is called with the base64 encoded data while it should has suitable data URL format on the following form: data:[<mediatype>][;base64],<data>

It is an old issue in the library and it was previously reported under: https://issues.apache.org/jira/browse/CB-9819

And recently, it was also reported by one of the library users: https://github.com/apache/cordova-plugin-camera/issues/420

Description

I have implemented and tested the DATA_URL fix across all of the Camera plugin supported platforms:

  1. Android (Java)
  2. iOS (Objective C)
  3. OS X (Objective C)
  4. Browser (JavaScript)
  5. Windows Platform (JavaScript)

Testing

I manually tested this change across all of these platforms and they work fine.

Checklist

  • [x] I've run the tests to see all new and existing tests pass
  • [x] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))

hazems avatar Mar 17 '19 00:03 hazems

Just the snake_case style in Android, otherwise LGTM

I will create a new PR to remove all old snake_case in the Android implementation to be compliant with Java Standards.

hazems avatar May 09 '19 22:05 hazems