diff --git a/source/dub/registry.d b/source/dub/registry.d index 643c221..4e34e6a 100644 --- a/source/dub/registry.d +++ b/source/dub/registry.d Binary files differ diff --git a/source/vibe/core/file.d b/source/vibe/core/file.d index 3f8b7c6..7e660e8 100644 --- a/source/vibe/core/file.d +++ b/source/vibe/core/file.d @@ -32,14 +32,17 @@ struct RangeFile { File file; alias file this; + void put(in char[] str) { file.write(str); } void put(char ch) { file.write(cast(ubyte)ch); } void put(dchar ch) { char[4] chars; put(chars[0 .. encode(chars, ch)]); } ubyte[] readAll() { - auto sz = file.size; + file.seek(0, SEEK_END); + auto sz = file.tell(); enforce(sz <= size_t.max, "File is too big to read to memory."); + file.seek(0, SEEK_SET); auto ret = new ubyte[cast(size_t)sz]; return file.rawRead(ret); } @@ -58,7 +61,9 @@ case FileMode.CreateTrunc: strmode = "wb+"; break; case FileMode.Append: strmode = "ab"; break; } - return RangeFile(File(path.toNativeString(), strmode)); + auto ret = File(path.toNativeString(), strmode); + assert(ret.isOpen()); + return RangeFile(ret); } /// ditto RangeFile openFile(string path, FileMode mode = FileMode.Read) diff --git a/source/vibe/inet/url.d b/source/vibe/inet/url.d index 2e6b1fa..b0736ee 100644 --- a/source/vibe/inet/url.d +++ b/source/vibe/inet/url.d @@ -163,7 +163,7 @@ const { auto str = appender!string(); str.reserve(m_pathString.length + 2 + queryString.length + anchor.length); - str.put(encodeComponent(path.toString())); + str.put(encode(path.toString())); if( queryString.length ) { str.put("?"); str.put(queryString); @@ -190,7 +190,7 @@ } m_pathString = str; - m_path = Path(decodeComponent(str)); + m_path = Path(decode(str)); } /// The URL to the parent path with query string and anchor stripped.