Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
datazuul committed Nov 9, 2018
1 parent 2785037 commit 0245eb1
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface FileNameResolver {
*/
default List<String> getStrings(String identifier, MimeType mimeType) throws ResourceIOException {
return getStrings(identifier).stream()
.filter(s -> MimeType.fromFilename(s).matches(mimeType))
.filter(s -> mimeType.matches(MimeType.fromFilename(s)))
.collect(Collectors.toList());
}

Expand All @@ -50,8 +50,9 @@ default List<URI> getUris(String identifier) throws ResourceIOException {
* @throws ResourceIOException in case getStrings for key fails
*/
default List<URI> getUris(String identifier, MimeType mimeType) throws ResourceIOException {
return getUris(identifier).stream()
.filter(u -> MimeType.fromURI(u).matches(mimeType))
final List<URI> uris = getUris(identifier);
return uris.stream()
.filter(u -> (mimeType.matches(MimeType.fromURI(u)) || MimeType.fromURI(u) == null))
.collect(Collectors.toList());
}

Expand All @@ -78,7 +79,7 @@ default List<Path> getPaths(String identifier) throws ResourceIOException {
*/
default List<Path> getPaths(String identifier, MimeType mimeType) throws ResourceIOException {
return getPaths(identifier).stream()
.filter(p -> MimeType.fromFilename(p.toString()).matches(mimeType))
.filter(p -> mimeType.matches(MimeType.fromFilename(p.toString())))
.collect(Collectors.toList());
}

Expand Down

0 comments on commit 0245eb1

Please sign in to comment.