Skip to content

Google Drive is storing the file in the root, ignoring the paths #42

@kelter-antunes

Description

@kelter-antunes

Hi,
It seems that GDrive adapter is not following the paths like azure blob and Amazon s3 are doing it. For those two everything is working as expected but not for GDrive.

// Adapter settings
string adapterPrefix = "gdrive";
string rootPath = "/demofolder";

// File system path settings
string path = "/from/demo/app";
string fileName = "example.env";
string localFilePath = @"C:\Users\XXXXXX\Downloads\example.env";

...

// Create Google Drive adapter
var googleDriveAdapter = new GoogleDriveAdapter(adapterPrefix, rootPath, driveService);

// Create file system with Google Drive adapter
googleDriveFileSystem = new FileSystem(new List<IAdapter> { googleDriveAdapter });

...

// Construct virtual path
virtualPath = $"{adapterPrefix}://{path}{fileName}"; // =  "gdrive://from/demo/app/example.env"

// Write file to Google Drive
googleDriveFileSystem.WriteFile(virtualPath, binaryData, true);

// Retrieve file from Google Drive
var existingFile = googleDriveFileSystem.GetFile(virtualPath);

The file is stored in the GDrive root:
image

And then when trying to get the file for the same virtualPath I get the following exception:

"File 'demofolder/from/demo/app/example.env' not found in adapter with prefix 'gdrive'."

Is it me that I'm doing anything wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions