mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-07 16:32:12 +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)
|
bool selectByPath(const(char)[] path, string rootDriveId, out Item item)
|
||||||
{
|
{
|
||||||
Item currItem = { driveId: rootDriveId };
|
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");
|
auto s = db.prepare("SELECT * FROM item WHERE name = ?1 AND driveId IS ?2 AND parentId IS ?3");
|
||||||
foreach (name; pathSplitter(path)) {
|
foreach (name; pathSplitter(path)) {
|
||||||
s.bind(1, name);
|
s.bind(1, name);
|
||||||
|
@ -238,7 +247,16 @@ final class ItemDatabase
|
||||||
bool selectByPathNoRemote(const(char)[] path, string rootDriveId, out Item item)
|
bool selectByPathNoRemote(const(char)[] path, string rootDriveId, out Item item)
|
||||||
{
|
{
|
||||||
Item currItem = { driveId: rootDriveId };
|
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");
|
auto s = db.prepare("SELECT * FROM item WHERE name IS ?1 AND driveId IS ?2 AND parentId IS ?3");
|
||||||
foreach (name; pathSplitter(path)) {
|
foreach (name; pathSplitter(path)) {
|
||||||
s.bind(1, name);
|
s.bind(1, name);
|
||||||
|
|
Loading…
Reference in a new issue