summaryrefslogtreecommitdiff
path: root/lib/uri/generic.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/uri/generic.rb')
-rw-r--r--lib/uri/generic.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index f3540a24bb..9ea2335cea 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -1364,6 +1364,9 @@ module URI
str << ':'
str << @port.to_s
end
+ if (@host || @port) && !@path.empty? && !@path.start_with?('/')
+ str << '/'
+ end
str << @path
if @query
str << '?'