Skip to content

Root path of alternative storage providers #6

@itafraze

Description

@itafraze

I am trying to make "dropbox" provider work. The retrieved storages have the following attributes (see #5):

2-element Vector{Dict{Symbol, Any}}:
 Dict(:kind => "folder", :provider => "osfstorage", :node => "qsabn", :path => "/", :name => "osfstorage")
 Dict(:kind => "folder", :provider => "dropbox", :node => "qsabn", :path => "/")

To get the directory reference one would use OSF.directory(proj, "/", storage = "dropbox"), but it would fail due to #5. To overcome the problem I added manually the :name key: storage.attributes[:name] = "dropbox". However, trying to execute API.find_by_path directly the following assertion error is triggered:

function find_by_path(osf::Client, root::Entity{:files}, path::String)
if root.attributes[:path] == "/"
@assert root.attributes[:name] == "osfstorage"

Working code:

import OpenScienceFramework as OSF

client = OSF.Client(view_only = "2a03b6c78ef14922a3e244f3d549de78")
proj = OSF.project(client, "qsabn")

storages = OSF.API.relationship(client, proj.entity, :files).data
storage = only(filter(s -> s.attributes[:provider] == "dropbox", storages))
storage.attributes[:name] = "dropbox"

directory = OSF.Directory(proj, storage, storage)
OSF.readdir(directory)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions