File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -131,13 +131,20 @@ void TUrl::SetUrl(const char *url, Bool_t defaultIsFile)
131
131
fHostFQ = " " ;
132
132
133
133
// if url starts with a / consider it as a file url
134
- if (url[0 ] == ' /' )
134
+ if (url[0 ] == ' /' ) {
135
135
defaultIsFile = kTRUE ;
136
+ // ROOT-5430: if url starts with two slashes but
137
+ // not three slashes, just remove the first of them
138
+ if (strlen (url) > 2 && url[1 ] == ' /' && url[2 ] != ' /' ) {
139
+ url = &url[1 ];
140
+ }
141
+ }
136
142
137
143
// Find protocol
138
144
char *s, sav;
139
145
140
146
TString surl = url;
147
+
141
148
char *u, *u0 = Strip (defaultIsFile && surl.EndsWith (" :/" ) ? TString (surl (0 ,surl.Length ()-2 )).Data () : url);
142
149
tryfile:
143
150
u = u0;
Original file line number Diff line number Diff line change @@ -12,4 +12,10 @@ TEST(TUrl, FilePath)
12
12
// https://its.cern.ch/jira/browse/ROOT-5820
13
13
TUrl u2 (" /tmp/a.root:/" , kTRUE ); // TFile.GetPath() returns a trailing :/
14
14
EXPECT_TRUE (u2.IsValid ());
15
+
16
+ // ROOT-5430
17
+ const char * ref_5430 = " file:///tmp/t.root" ;
18
+ EXPECT_STREQ (TUrl (" /tmp/t.root" ).GetUrl (), ref_5430);
19
+ EXPECT_STREQ (TUrl (" //tmp/t.root" ).GetUrl (), ref_5430);
20
+ EXPECT_STREQ (TUrl (" ///tmp/t.root" ).GetUrl (), ref_5430);
15
21
}
You can’t perform that action at this time.
0 commit comments