Skip to content

Commit

Permalink
v2.5.4
Browse files Browse the repository at this point in the history
- Fix `MimeType.parse` when parameter `mimeType` is empty and `defaultMimeType` is null.
- Fix `DataURLBase64.asDataURLString`
- dartfmt.
  • Loading branch information
gmpassos committed Jul 11, 2020
1 parent 7b6cdd6 commit f6a44dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.5.4

- Fix `MimeType.parse` when parameter `mimeType` is empty and `defaultMimeType` is null.
- Fix `DataURLBase64.asDataURLString`
- dartfmt.

## 2.5.3

- fix buildStringPattern() extraParameters issue.
Expand Down
8 changes: 3 additions & 5 deletions lib/src/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ class MimeType {
mimeType ??= defaultMimeType;

if (mimeType == null) return null;

mimeType = mimeType.trim();

if (mimeType.isEmpty) mimeType = defaultMimeType;
if (mimeType == null) return null;
mimeType = mimeType.trim();
if (mimeType.isEmpty) return null;

mimeType = mimeType.toLowerCase();
Expand Down Expand Up @@ -243,8 +243,6 @@ class DataURLBase64 {
return data != null ? latin1.decode(data) : null;
}

//////////////////////////////////
/// Returns true if [s] is in Data URL (Base-64) format.
static bool matches(String s) {
return DataURLBase64.parse(s) != null;
Expand Down Expand Up @@ -340,7 +338,7 @@ class DataURLBase64 {
/// Example: `data:text/plain;base64,SGVsbG8=`
/// that encodes `Hello` with MIME-Type `text/plain`.
String asDataURLString() {
_dataURLString ??= 'data:$mimeTypeAsString;base64,$payloadBase64}';
_dataURLString ??= 'data:$mimeTypeAsString;base64,$payloadBase64';
return _dataURLString;
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: swiss_knife
description: Dart Useful Tools - collections, math, date, uri, json, events, resources, regexp, etc...
version: 2.5.3
version: 2.5.4
homepage: https://github.com/gmpassos/swiss_knife

environment:
Expand Down

0 comments on commit f6a44dd

Please sign in to comment.