Skip to content

Commit

Permalink
title may contain "/"
Browse files Browse the repository at this point in the history
  • Loading branch information
autoandshare committed Apr 26, 2019
1 parent fa31443 commit 99255e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/main/java/autoandshare/headvr/lib/PathUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
import android.net.Uri;

public class PathUtil {
public static String getFilename(Uri uri) {
String[] path = uri.getPath().split("/");
return path[path.length - 1];
public static String getFilename(String path) {
String[] parts = path.split("/");
if ((parts != null) && (parts.length != 0)) {
return parts[parts.length - 1];
} else {
return "";
}
}

public static String getFilename(Uri uri) {
return getFilename(uri.getPath());
}

public static String getKey(Uri uri) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/autoandshare/headvr/lib/VideoRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private void getVideoType() {
VideoType videoType = new VideoType();

propertyKey = PathUtil.getKey(uri);
state.fileName = mw.getTitle();
state.fileName = PathUtil.getFilename(mw.getTitle());

Matcher matcher = fileNamePattern.matcher(state.fileName);
if (matcher.find()) {
Expand Down

0 comments on commit 99255e5

Please sign in to comment.