mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-17 13:16:41 +02:00
Fix hidden directories in 'root' from having prefix removed (#586)
* Fix hidden directories in 'root' from having prefix removed
This commit is contained in:
parent
c16ba1ba2f
commit
68c6c5d75d
22
src/itemdb.d
22
src/itemdb.d
|
@ -212,7 +212,16 @@ final class ItemDatabase
|
|||
bool selectByPath(const(char)[] path, string rootDriveId, out Item item)
|
||||
{
|
||||
Item currItem = { driveId: rootDriveId };
|
||||
path = "root/" ~ path.chompPrefix(".");
|
||||
|
||||
// Issue https://github.com/abraunegg/onedrive/issues/578
|
||||
if (startsWith(path, "./") || path == ".") {
|
||||
// Need to remove the . from the path prefix
|
||||
path = "root/" ~ path.chompPrefix(".");
|
||||
} else {
|
||||
// Leave path as it is
|
||||
path = "root/" ~ path;
|
||||
}
|
||||
|
||||
auto s = db.prepare("SELECT * FROM item WHERE name = ?1 AND driveId IS ?2 AND parentId IS ?3");
|
||||
foreach (name; pathSplitter(path)) {
|
||||
s.bind(1, name);
|
||||
|
@ -238,7 +247,16 @@ final class ItemDatabase
|
|||
bool selectByPathNoRemote(const(char)[] path, string rootDriveId, out Item item)
|
||||
{
|
||||
Item currItem = { driveId: rootDriveId };
|
||||
path = "root/" ~ path.chompPrefix(".");
|
||||
|
||||
// Issue https://github.com/abraunegg/onedrive/issues/578
|
||||
if (startsWith(path, "./") || path == ".") {
|
||||
// Need to remove the . from the path prefix
|
||||
path = "root/" ~ path.chompPrefix(".");
|
||||
} else {
|
||||
// Leave path as it is
|
||||
path = "root/" ~ path;
|
||||
}
|
||||
|
||||
auto s = db.prepare("SELECT * FROM item WHERE name IS ?1 AND driveId IS ?2 AND parentId IS ?3");
|
||||
foreach (name; pathSplitter(path)) {
|
||||
s.bind(1, name);
|
||||
|
|
Loading…
Reference in a new issue