mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-06 04:00:08 +00:00
Fixed an issue where file URIs on Windows would not be parsed correctly
This commit is contained in:
parent
47f607c2d3
commit
85ec71d6e4
2 changed files with 15 additions and 9 deletions
|
|
@ -343,14 +343,7 @@ bool URL::isWellFormed() const
|
|||
|
||||
String URL::getDomain() const
|
||||
{
|
||||
auto start = URLHelpers::findStartOfNetLocation (url);
|
||||
auto end1 = url.indexOfChar (start, '/');
|
||||
auto end2 = url.indexOfChar (start, ':');
|
||||
|
||||
auto end = (end1 < 0 && end2 < 0) ? std::numeric_limits<int>::max()
|
||||
: ((end1 < 0 || end2 < 0) ? jmax (end1, end2)
|
||||
: jmin (end1, end2));
|
||||
return url.substring (start, end);
|
||||
return getDomainInternal (false);
|
||||
}
|
||||
|
||||
String URL::getSubPath() const
|
||||
|
|
@ -391,7 +384,7 @@ File URL::fileFromFileSchemeURL (const URL& fileURL)
|
|||
return {};
|
||||
}
|
||||
|
||||
auto path = removeEscapeChars (fileURL.getDomain()).replace ("+", "%2B");
|
||||
auto path = removeEscapeChars (fileURL.getDomainInternal (true)).replace ("+", "%2B");
|
||||
|
||||
#ifdef JUCE_WINDOWS
|
||||
bool isUncPath = (! fileURL.url.startsWith ("file:///"));
|
||||
|
|
@ -529,6 +522,18 @@ bool URL::isProbablyAnEmailAddress (const String& possibleEmailAddress)
|
|||
&& ! possibleEmailAddress.endsWithChar ('.');
|
||||
}
|
||||
|
||||
String URL::getDomainInternal (bool ignorePort) const
|
||||
{
|
||||
auto start = URLHelpers::findStartOfNetLocation (url);
|
||||
auto end1 = url.indexOfChar (start, '/');
|
||||
auto end2 = ignorePort ? -1 : url.indexOfChar (start, ':');
|
||||
|
||||
auto end = (end1 < 0 && end2 < 0) ? std::numeric_limits<int>::max()
|
||||
: ((end1 < 0 || end2 < 0) ? jmax (end1, end2)
|
||||
: jmin (end1, end2));
|
||||
return url.substring (start, end);
|
||||
}
|
||||
|
||||
#if JUCE_IOS
|
||||
URL::Bookmark::Bookmark (void* bookmarkToUse)
|
||||
: data (bookmarkToUse)
|
||||
|
|
|
|||
|
|
@ -526,6 +526,7 @@ private:
|
|||
StringArray parameterNames, parameterValues;
|
||||
|
||||
static File fileFromFileSchemeURL (const URL&);
|
||||
String getDomainInternal (bool) const;
|
||||
|
||||
struct Upload : public ReferenceCountedObject
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue