buckyos/CYFS

Create restore task not save archive file to disk

lizhihongTest opened this issue · 1 comments

Describe the bug

  • Create restore task 002
          let response : Response = await fetch("http://192.168.100.205:1320/restore", {
                method: "POST",
                body: JSON.stringify({
                    id : "002",
                    remote_archive : "http://192.168.200.151/002/index",
                    cyfs_root : "/cyfs",
                    password : "token-dhjfkfsfsaf"
                }),
                headers: {'Content-Type': 'application/json'},
            });
  • ood-daemon
    download archive file complete: http://192.168.200.151/002/index -> /cyfs/tmp/restore/002/archive, len=2603bytes
    but not find in disk path /cyfs/tmp/restore
root@filecoin2:/cyfs/log/ood-daemon# ls -alt /cyfs/tmp/restore/
total 8
drwxr-xr-x 2 root root 4096 May  5 16:08 .
drwxrwxrwx 4 root root 4096 May  5 15:24 ..
  • Get restore task status response
[info],[2023-05-05 16:08:35.925],<>,Get restore task status: "{\"phase\":\"Complete\",\"result\":{\"Err\":{\"code\":\"22\",\"msg\":\"open archive file failed! file=/cyfs/tmp/restore/002/archive, invalid 
Zip archive: Could not find central directory end\"}},\"download_progress\":null,\"unpack_progress\":null,\"restore_status\":null}", test_back_up_ood_control_based.ts:651

Additional context
#228

ood-daemon_975934_rCURRENT.log

remote_archive parameter is not set correctly according to the rules:

#228 (comment)

At present, considering the complexity of the url itself, users may get the remote archive through the url with parameters and extra path segments, so zip and dir types are distinguished by remote_archive itself, the key difference is that there is a ${filename} keyword inside the url of dir type

So according to your call code, you need to set the remote_archive inside the call parameter to .

remote_archive : "http://192.168.200.151/002/${filename}".