@@ -69,12 +69,9 @@ func (d *Crypt) Init(ctx context.Context) error {
6969 return fmt .Errorf ("can't find remote storage: %w" , err )
7070 }
7171
72- // ensure the remote (upper-level) storage is initialized and healthy
73- // If the upper-level storage failed to initialize, refuse to load this crypt driver.
74- if storage .Config ().CheckStatus && storage .GetStorage ().Status != op .WORK {
75- return fmt .Errorf ("remote storage not ready (status=%s)" , storage .GetStorage ().Status )
76- }
77-
72+ // keep reference to remote (upper-level) storage; don't refuse to load here
73+ // upper-level storage readiness will be checked per-operation via
74+ // GetStorageAndActualPath (wrapped by getActualPathForRemote)
7875 d .remoteStorage = storage
7976
8077 p , _ := strings .CutPrefix (d .Password , obfuscatedPrefix )
@@ -119,7 +116,11 @@ func (d *Crypt) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([
119116 // return d.list(ctx, d.RemotePath, path)
120117 // remoteFull
121118
122- objs , err := fs .List (ctx , d .getPathForRemote (path , true ), & fs.ListArgs {NoLog : true , Refresh : args .Refresh })
119+ actualPath , err := d .getActualPathForRemote (path , true )
120+ if err != nil {
121+ return nil , err
122+ }
123+ objs , err := fs .List (ctx , actualPath , & fs.ListArgs {NoLog : true , Refresh : args .Refresh })
123124 // the obj must implement the model.SetPath interface
124125 // return objs, err
125126 if err != nil {
@@ -201,17 +202,21 @@ func (d *Crypt) Get(ctx context.Context, path string) (model.Obj, error) {
201202 Path : "/" ,
202203 }, nil
203204 }
204- remoteFullPath := ""
205205 var remoteObj model.Obj
206- var err , err2 error
207206 firstTryIsFolder , secondTry := guessPath (path )
208- remoteFullPath = d .getPathForRemote (path , firstTryIsFolder )
209- remoteObj , err = fs .Get (ctx , remoteFullPath , & fs.GetArgs {NoLog : true })
207+ remoteActualPath , err := d .getActualPathForRemote (path , firstTryIsFolder )
208+ if err != nil {
209+ return nil , fmt .Errorf ("failed to convert path to remote path: %w" , err )
210+ }
211+ remoteObj , err = fs .Get (ctx , remoteActualPath , & fs.GetArgs {NoLog : true })
210212 if err != nil {
211213 if errs .IsObjectNotFound (err ) && secondTry {
212214 // try the opposite
213- remoteFullPath = d .getPathForRemote (path , ! firstTryIsFolder )
214- remoteObj , err2 = fs .Get (ctx , remoteFullPath , & fs.GetArgs {NoLog : true })
215+ remoteActualPath , err2 := d .getActualPathForRemote (path , ! firstTryIsFolder )
216+ if err2 != nil {
217+ return nil , fmt .Errorf ("failed to convert path to remote path: %w" , err2 )
218+ }
219+ remoteObj , err2 = fs .Get (ctx , remoteActualPath , & fs.GetArgs {NoLog : true })
215220 if err2 != nil {
216221 return nil , err2
217222 }
0 commit comments