alexiscn / SynologyKit

Synology File Station SDK for Swift
MIT License
36 stars 8 forks source link

Search Files Decode Error #14

Open VladLikov opened 2 years ago

VladLikov commented 2 years ago

Hi, I'm trying to search files in directory with this method:

var options = SynologyClient.SearchOptions();
options.pattern = "*.jpg";
client.search(atFolderPath: folderPath, options: options) { result in
    switch result {
    case .success(let task):
        for file in task.files {
            print(file.path)
        } 
    case .failure(let error):
        print(error.description)
    }
}

But I'm getting this error:

[Request]: POST http://192.168.1.94:5000/webapi/entry.cgi
    [Headers]:
        Content-Type: application/x-www-form-urlencoded; charset=utf-8
    [Body]: 165 bytes
[Response]:
    [Status Code]: 200
    [Headers]:
        Cache-Control: max-age=0, no-cache, no-store, must-revalidate
        Connection: keep-alive
        Content-Encoding: gzip
        Content-Type: application/json; charset="UTF-8"
        Date: Fri, 14 Jan 2022 21:12:49 GMT
        Expires: 0
        Keep-Alive: timeout=20
        Pragma: no-cache
        Server: nginx
        Set-Cookie: id=mDJ-xozvTd0pUn0tvoL9HU2dTpH8i5YRP5hf-ZovUi805PkRrY2Ob0F8zu7QMhWis6h1MmxnVmpMPyrfCmtFoM;expires=Fri, 21-Jan-2022 21:12:49 GMT;path=/;HttpOnly
        Transfer-Encoding: Identity
        Vary: Accept-Encoding
        X-Content-Type-Options: nosniff
        X-XSS-Protection: 1; mode=block
    [Body]:
        {"data":{"finished":true},"success":true}
[Network Duration]: 0.05960500240325928s
[Serialization Duration]: 0.0s
[Result]: success(Optional(41 bytes))
"{\"data\":{\"finished\":true},\"success\":true}"
Decode Error

Can someone help me please?

Thanks.