| Index: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| index dac06697673f0c74635c5823fdecf9d1082d2981..769b9300a1828491f7a983e3c9a7f995ae95f074 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
|
| @@ -587,15 +587,17 @@ public class ShortcutHelper {
|
| @CalledByNative
|
| public static String getScopeFromUrl(String url) {
|
| // Scope URL is generated by:
|
| - // - Removing last component of the URL.
|
| + // - Removing last component of the URL if it does not end with a slash.
|
| // - Clearing the URL's query and fragment.
|
|
|
| Uri uri = Uri.parse(url);
|
| List<String> path = uri.getPathSegments();
|
| int endIndex = path.size();
|
|
|
| - // If there is at least one path element, remove the last one.
|
| - if (endIndex > 0) {
|
| + // Remove the last path element if there is at least one path element, *and* the path does
|
| + // not end with a slash. This means that URLs to specific files have the file component
|
| + // removed, but URLs to directories retain the directory.
|
| + if (endIndex > 0 && !uri.getPath().endsWith("/")) {
|
| endIndex -= 1;
|
| }
|
|
|
|
|