Fix URL-to-path conversion for URLs with percent encoding#17
Fix URL-to-path conversion for URLs with percent encoding#17FreeSlave merged 3 commits intoFreeSlave:masterfrom
Conversation
Falls back to the previous behavior as a fallback in case of encoding errors.
Fixes unit test failures for `""` and `"" " "` inputs.
|
Thanks. I ran CI and unittests failed on dmd. It doesn't seem to be related to your changes though. Maybe some changes to dmd or phobos caused this. I'll take a look later, and then merge. |
|
The error is caused by the line in the dependency Has it become illegal to use If I change to auto f = File(fileName, "r");
return iniLikeRangeReader(f.byLineCopy());then it works. It also worked fine without changes on dmd v2.109.1. Could be some regression? Can't find anything related in the changelog for 2.111.0 and 2.110.0 |
|
Interesting, it smells a bit like it might be related to lifetime management changes (there were some related to I tried to make a reproduction case, but that works without issues on DMD 2.111.0 (posting here, because run.dlang.io's short link generation doesn't work): import std;
struct S(R) {
R _r;
this(R r) { _r = r; }
bool empty() { return _r.empty; }
auto front() { return _r.front; }
void popFront() { _r.popFront(); }
auto byLeadingLines()
{
return _r.until!(isGroupHeader);
}
}
@nogc @safe bool isGroupHeader(scope const(char)[] s) pure nothrow
{
s = s.stripRight;
return s.length > 2 && s[0] == '[' && s[$-1] == ']';
}
S!R s(R)(R r) { return S!R(r); }
pragma(msg, "DMD " ~ __VERSION__.stringof);
auto getRange()
{
return s(File("test.txt", "r").byLineCopy);
}
void main()
{
auto f = File("test.txt", "w");
f.write("foo");
f.close();
foreach (ln; getRange().byLeadingLines)
writeln("LINE: ", ln);
} |
|
This reproduces the issue for me import std;
pragma(msg, "DMD " ~ __VERSION__.stringof);
auto iniLikeFileReader(string fileName)
{
//auto f = File(fileName, "r");
//return f.byLineCopy();
return File(fileName, "r").byLineCopy();
}
void readIniLike(Reader)(Reader reader) {}
class Handler
{
public:
this(Range)(Range reader)
{
readIniLike(reader);
}
private:
string _fileName;
}
unittest
{
string fileName = "test.txt";
auto f = File(fileName, "w");
f.write(`# The first comment`);
f.close();
Handler h = new Handler(iniLikeFileReader(fileName));
}
void main() {}Compile with Looks like just passing the range around without even iterating over it can cause the error. |
|
Reported as dlang/dmd#21598 |
|
String concatenation behavior has changed as well. Merging, thanks again. |
|
Yeah, the string concatenation behavior is probably unspecified in that regard, although the previous behavior was quite useful for avoiding redundant checks/flags. Generally, I feel like null checks on arrays always have a slightly bitter taste, as |
Falls back to the previous behavior as a fallback in case of encoding errors.