summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2018-11-06 19:00:49 +0100
committerGitHub <noreply@github.com>2018-11-06 19:00:49 +0100
commit147bf6f4af1e68c29988fc7fd82d08b2733491f3 (patch)
treec21bbbb65cec67d17e0a3d30d9b47b2090862b4b
parenta93a963ca99a2c704325c2db121cd81476e350cd (diff)
downloadmidori-git-147bf6f4af1e68c29988fc7fd82d08b2733491f3.tar.gz
Check for space in text before other URI magic (#153)
A space anywhere should lead to a web search.
-rw-r--r--core/urlbar.vala7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/urlbar.vala b/core/urlbar.vala
index aaf11715..25c33de5 100644
--- a/core/urlbar.vala
+++ b/core/urlbar.vala
@@ -180,7 +180,9 @@ namespace Midori {
}
string? magic_uri (string text) {
- if (Path.is_absolute (text)) {
+ if (" " in text) {
+ return null;
+ } else if (Path.is_absolute (text)) {
try {
return Filename.to_uri (text);
} catch (ConvertError error ) {
@@ -209,10 +211,9 @@ namespace Midori {
bool is_location (string uri) {
/* file:// is not considered a location for security reasons */
- return (("://" in uri && !(" " in uri)))
+ return uri.has_prefix ("about:")
|| uri.has_prefix ("http://")
|| uri.has_prefix ("https://")
- || uri.has_prefix ("about:")
|| (uri.has_prefix ("data:") && (";" in uri))
|| uri.has_prefix ("javascript:");
}