Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
ec1e04a6
Commit
ec1e04a6
authored
Jan 20, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix/1043/remove-basepath-handling' of
git://github.com/PVince81/MPD
into v0.22.x
parents
97a2122f
ec0d3ac9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
20 deletions
+4
-20
CurlStorage.cxx
src/storage/plugins/CurlStorage.cxx
+4
-20
No files found.
src/storage/plugins/CurlStorage.cxx
View file @
ec1e04a6
...
...
@@ -468,19 +468,11 @@ CurlStorage::GetInfo(std::string_view uri_utf8, [[maybe_unused]] bool follow)
gcc_pure
static
std
::
string_view
UriPathOrSlash
(
const
char
*
uri
,
bool
relative
)
noexcept
UriPathOrSlash
(
const
char
*
uri
)
noexcept
{
auto
path
=
uri_get_path
(
uri
);
if
(
path
.
data
()
==
nullptr
)
path
=
"/"
;
else
if
(
relative
)
{
// search after first slash
path
=
path
.
substr
(
1
);
auto
slash
=
path
.
find
(
'/'
);
if
(
slash
!=
std
::
string_view
::
npos
)
path
=
path
.
substr
(
slash
);
}
return
path
;
}
...
...
@@ -489,15 +481,13 @@ UriPathOrSlash(const char *uri, bool relative) noexcept
*/
class
HttpListDirectoryOperation
final
:
public
PropfindOperation
{
const
std
::
string
base_path
;
const
std
::
string
base_path_relative
;
MemoryStorageDirectoryReader
::
List
entries
;
public
:
HttpListDirectoryOperation
(
CurlGlobal
&
curl
,
const
char
*
uri
)
:
PropfindOperation
(
curl
,
uri
,
1
),
base_path
(
CurlUnescape
(
GetEasy
(),
UriPathOrSlash
(
uri
,
false
))),
base_path_relative
(
CurlUnescape
(
GetEasy
(),
UriPathOrSlash
(
uri
,
true
)))
{}
base_path
(
CurlUnescape
(
GetEasy
(),
UriPathOrSlash
(
uri
)))
{}
std
::
unique_ptr
<
StorageDirectoryReader
>
Perform
()
{
DeferStart
();
...
...
@@ -523,15 +513,9 @@ private:
/* kludge: ignoring case in this comparison to avoid
false negatives if the web server uses a different
case */
if
(
uri_has_scheme
(
path
))
{
path
=
StringAfterPrefixIgnoreCase
(
path
,
base_path
.
c_str
());
}
else
{
path
=
StringAfterPrefixIgnoreCase
(
path
,
base_path_relative
.
c_str
());
}
if
(
path
==
nullptr
||
path
.
empty
())
{
path
=
StringAfterPrefixIgnoreCase
(
path
,
base_path
.
c_str
());
if
(
path
==
nullptr
||
path
.
empty
())
return
nullptr
;
}
const
char
*
slash
=
path
.
Find
(
'/'
);
if
(
slash
==
nullptr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment