Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2619481
D25561.1731642554.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
D25561.1731642554.diff
View Options
diff --git a/src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php b/src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php
--- a/src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php
+++ b/src/applications/meta/engineextension/PhabricatorDatasourceURIEngineExtension.php
@@ -10,35 +10,37 @@
public function newJumpURI($query) {
// If you search for a URI on the local install, just redirect to that
// URI as though you had pasted it into the URI bar.
- if (PhabricatorEnv::isSelfURI($query)) {
- // Strip off the absolute part of the URI. If we don't, the URI redirect
- // validator will get upset that we're performing an unmarked external
- // redirect.
-
- // The correct host and protocol may also differ from the host and
- // protocol used in the search: for example, if you search for "http://"
- // we want to redirect to "https://" if an install is HTTPS, and
- // the "isSelfURI()" check includes alternate domains in addition to the
- // canonical domain.
-
- $uri = id(new PhutilURI($query))
- ->setDomain(null)
- ->setProtocol(null)
- ->setPort(null);
-
- $uri = phutil_string_cast($uri);
-
- // See T13412. If the URI was in the form "http://dev.example.com" with
- // no trailing slash, there may be no path. Redirecting to the empty
- // string is considered an error by safety checks during redirection,
- // so treat this like the user entered the URI with a trailing slash.
- if (!strlen($uri)) {
- $uri = '/';
- }
-
- return $uri;
+ // Skip things that are really not full URLs, like "asdasd".
+ // Note that the backend of "isSelfURI" is faster with a PhutilURI.
+ $uri = new PhutilURI($query);
+ if ($uri->getDomain() === '' || !PhabricatorEnv::isSelfURI($uri)) {
+ return null;
}
- return null;
+ // Strip off the absolute part of the URI. If we don't, the URI redirect
+ // validator will get upset that we're performing an unmarked external
+ // redirect.
+
+ // The correct host and protocol may also differ from the host and
+ // protocol used in the search: for example, if you search for "http://"
+ // we want to redirect to "https://" if an install is HTTPS, and
+ // the "isSelfURI()" check includes alternate domains in addition to the
+ // canonical domain.
+ $uri = $uri
+ ->setDomain(null)
+ ->setProtocol(null)
+ ->setPort(null);
+
+ $uri = phutil_string_cast($uri);
+
+ // See T13412. If the URI was in the form "http://dev.example.com" with
+ // no trailing slash, there may be no path. Redirecting to the empty
+ // string is considered an error by safety checks during redirection,
+ // so treat this like the user entered the URI with a trailing slash.
+ if (!strlen($uri)) {
+ $uri = '/';
+ }
+
+ return $uri;
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 03:49 (10 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
971079
Default Alt Text
D25561.1731642554.diff (2 KB)
Attached To
Mode
D25561: Fix important regression in search engine
Attached
Detach File
Event Timeline
Log In to Comment