Juha Kuitunen avatar Juha Kuitunen committed 15e3bd9

bugfix: view diff for files with whitespace character in name

Comments (0)

Files changed (1)


 	public void AsyncLoaderDone(String result) {
 		result = splitDiff(result);
-		if (result.equals("")) result = "Diff not found for requested file.\nPrivate repositories not supported.";
+		if (result.equals("")) result = "Diff not found for requested file.";
 		code = TextUtils.htmlEncode(result.replace("\t", "  "));
 		WebView webView = (WebView) findViewById(R.id.diff_webview);
 		// search only requested file's diff and display it
 		String lines[] = input.split("\n");
 		String contents = "";
-		String filename = "";
 		boolean right_file = false;
 		for (int i=0; i<lines.length; i++) {
 			if ( lines[i].matches("^diff -r .*") || lines[i].matches("^diff --git .*") ) {
-				String[] tmp = lines[i].split(" ");
-				filename = tmp[tmp.length-1];
-				if (lines[i].matches("^diff --git .*"))
-					filename = filename.substring(2);
-				if (filename.equals(file)) {
+				if (lines[i].matches(".*"+file+"$")) {
 					right_file = true;
 					contents = contents + lines[i] + "\n";
 				} else right_file = false;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.