pCloud / pcloud-sdk-java

The official pCloud Java SDK repository
https://pcloud.github.io/pcloud-sdk-java/
Apache License 2.0
39 stars 14 forks source link

Downloading files sometimes fails with HTTP status code 404 #40

Closed SailReal closed 1 year ago

SailReal commented 2 years ago

Pretty the same as in https://github.com/pCloud/pcloud-sdk-java/issues/39 but here the user gets a 404 after getting the download link and regardless of what kind of network they are in.

20221107084947.001  OkHttp  --> GET https://api.pcloud.com/stat?path=/Cryptomator%20pCloud%20FUSE/d/5I/UR4U7IDF2RZWFNVUFGHMN7IE2FTDZ4/kwFjq-_uNtDPN386UKwtD8j_QRE6yAPkBg%3D%3D.c9r/dir.c9r http/1.1 (unknown length)
20221107084947.001  OkHttp  User-Agent: pCloud SDK Java unspecified
20221107084947.001  OkHttp  --> END GET
20221107084947.118  OkHttp  <-- 200 OK https://api.pcloud.com/stat?path=/Cryptomator%20pCloud%20FUSE/d/5I/UR4U7IDF2RZWFNVUFGHMN7IE2FTDZ4/kwFjq-_uNtDPN386UKwtD8j_QRE6yAPkBg%3D%3D.c9r/dir.c9r (116ms)
20221107084947.118  OkHttp  Server: CloudHTTPd-API v1.1
20221107084947.118  OkHttp  Date: Mon, 07 Nov 2022 13:49:46 GMT
20221107084947.119  OkHttp  ETag: "Lc1nNLlqRmjsiMaVDGkA9zjcf5uX"
20221107084947.119  OkHttp  Cache-Control: private, max-age=0
20221107084947.119  OkHttp  Vary: Accept-Encoding
20221107084947.119  OkHttp  Connection: keep-alive
20221107084947.119  OkHttp  Keep-Alive: timeout=1800
20221107084947.119  OkHttp  <-- END HTTP
20221107084947.120  OkHttp  --> GET https://api.pcloud.com/getfilelink?path=/Cryptomator%20pCloud%20FUSE/d/5I/UR4U7IDF2RZWFNVUFGHMN7IE2FTDZ4/kwFjq-_uNtDPN386UKwtD8j_QRE6yAPkBg%3D%3D.c9r/dir.c9r http/1.1 (unknown length)
20221107084947.120  OkHttp  User-Agent: pCloud SDK Java unspecified
20221107084947.120  OkHttp  --> END GET
20221107084947.186  OkHttp  <-- 200 OK https://api.pcloud.com/getfilelink?path=/Cryptomator%20pCloud%20FUSE/d/5I/UR4U7IDF2RZWFNVUFGHMN7IE2FTDZ4/kwFjq-_uNtDPN386UKwtD8j_QRE6yAPkBg%3D%3D.c9r/dir.c9r (66ms)
20221107084947.187  OkHttp  Server: CloudHTTPd-API v1.1
20221107084947.187  OkHttp  Date: Mon, 07 Nov 2022 13:49:46 GMT
20221107084947.187  OkHttp  ETag: "nYEP71ojrYBsAVAN2MNSffA48UMk"
20221107084947.187  OkHttp  Cache-Control: private, max-age=0
20221107084947.187  OkHttp  Vary: Accept-Encoding
20221107084947.187  OkHttp  Connection: keep-alive
20221107084947.187  OkHttp  Keep-Alive: timeout=1800
20221107084947.187  OkHttp  <-- END HTTP
20221107084947.189  OkHttp  --> GET https://vc535.pcloud.com/dpZoXb6PPZnM1QpUZKr3h7ZYZ32cWc7Z2ZZvKVZZ1YoRvsve5EXg91BXwsggLHsfT3W7/dir.c9r http/1.1 (unknown length)
20221107084947.189  OkHttp  User-Agent: pCloud SDK Java unspecified
20221107084947.189  OkHttp  --> END GET
20221107084947.543  OkHttp  <-- 404 Not Found https://vc535.pcloud.com/dpZoXb6PPZnM1QpUZKr3h7ZYZ32cWc7Z2ZZvKVZZ1YoRvsve5EXg91BXwsggLHsfT3W7/dir.c9r (352ms)
20221107084947.544  OkHttp  Server: CloudHTTPd v1.1
20221107084947.545  OkHttp  Date: Mon, 07 Nov 2022 13:49:47 +0000
20221107084947.545  OkHttp  Connection: close
20221107084947.545  OkHttp  <-- END HTTP
20221107084947.548  GetCloudListUseCase failed 4e46df08
20221107084947.551  ExceptionHandler    Unexpected error
org.cryptomator.domain.exception.NetworkConnectionException: org.cryptomator.domain.exception.FatalBackendException: java.io.FileNotFoundException: The requested file cannot be found or the file link has expired.
    at org.cryptomator.data.cloud.pcloud.PCloudContentRepository.throwConnectionErrorIfRequired(PCloudContentRepository.kt:32)
    at org.cryptomator.data.cloud.pcloud.PCloudContentRepository.throwWrappedIfRequired(PCloudContentRepository.kt:25)
    at org.cryptomator.data.cloud.InterceptingCloudContentRepository.read(InterceptingCloudContentRepository.kt:173)
    at org.cryptomator.data.repository.DispatchingCloudContentRepository.read(DispatchingCloudContentRepository.kt:160)
    at org.cryptomator.data.cloud.crypto.CryptoImplVaultFormat7.loadContentsOfDirFile(CryptoImplVaultFormat7.kt:293)
    at org.cryptomator.data.cloud.crypto.CryptoImplVaultFormat7.loadDirId(CryptoImplVaultFormat7.kt:283)
    at org.cryptomator.data.cloud.crypto.CryptoImplVaultFormat7.getDirIdInfo(CryptoImplVaultFormat7.kt:263)
    at org.cryptomator.data.cloud.crypto.CryptoImplDecorator.getCachingAwareDirIdInfo(CryptoImplDecorator.kt:366)
    at org.cryptomator.data.cloud.crypto.CryptoImplVaultFormat7.list(CryptoImplVaultFormat7.kt:135)
    at org.cryptomator.data.cloud.crypto.CryptoCloudContentRepository.list(CryptoCloudContentRepository.kt:58)
    at org.cryptomator.data.cloud.crypto.CryptoCloudContentRepository.list(CryptoCloudContentRepository.kt:21)
    at org.cryptomator.data.repository.DispatchingCloudContentRepository.list(DispatchingCloudContentRepository.kt:103)
    at org.cryptomator.domain.usecases.cloud.GetCloudList.execute(GetCloudList.java:24)
    at org.cryptomator.domain.usecases.cloud.GetCloudListUseCase$Launcher$2.call(GetCloudListUseCase.java:92)
    at org.cryptomator.domain.usecases.cloud.GetCloudListUseCase$Launcher$2.call(GetCloudListUseCase.java:86)
    at io.reactivex.internal.operators.flowable.FlowableFromCallable.subscribeActual(FlowableFromCallable.java:39)
    at io.reactivex.Flowable.subscribe(Flowable.java:14935)
    at io.reactivex.Flowable.subscribe(Flowable.java:14882)
    at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
    at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:288)
    at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:253)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)
Caused by: org.cryptomator.domain.exception.FatalBackendException: java.io.FileNotFoundException: The requested file cannot be found or the file link has expired.
    at org.cryptomator.data.cloud.pcloud.PCloudContentRepository$Intercepted.read(PCloudContentRepository.kt:150)
    at org.cryptomator.data.cloud.pcloud.PCloudContentRepository$Intercepted.read(PCloudContentRepository.kt:47)
    at org.cryptomator.data.cloud.InterceptingCloudContentRepository.read(InterceptingCloudContentRepository.kt:168)
    ... 21 more
Caused by: java.io.FileNotFoundException: The requested file cannot be found or the file link has expired.
    at com.pcloud.sdk.internal.RealApiClient.lambda$download$5$com-pcloud-sdk-internal-RealApiClient(RealApiClient.java:496)
    at com.pcloud.sdk.internal.RealApiClient$$ExternalSyntheticLambda19.adapt(Unknown Source:6)
    at com.pcloud.sdk.internal.OkHttpCall.adapt(OkHttpCall.java:101)
    at com.pcloud.sdk.internal.OkHttpCall.execute(OkHttpCall.java:43)
    at org.cryptomator.data.cloud.pcloud.PCloudImpl.writeToData(PCloudImpl.kt:274)
    at org.cryptomator.data.cloud.pcloud.PCloudImpl.read(PCloudImpl.kt:246)
    at org.cryptomator.data.cloud.pcloud.PCloudContentRepository$Intercepted.read(PCloudContentRepository.kt:148)
    ... 23 more
LearningAsIGo71 commented 2 years ago

Is this getting attention? It is affecting my use of pCloud.

LearningAsIGo71 commented 1 year ago

Is the pCloud team on holiday? I have now experienced the error documented above multiple times when trying to access a folder via multiple Android phones in a Cryptomator vault in pCloud. The message displayed on the Android phones is "No network connection." The folder was accessible for months and then one day became inaccessible. On one occasion moving the folder to a different parent folder made the folder accessible again, but that workaround no longer works. Thankfully I can still access the folder on my desktop and laptop PCs via Cryptomator/Windows Explorer. This bug on Android needs to be fixed ASAP. I have a 10TB pCloud account, which I no longer trust to use until this problem is fixed. [Edit: grammar]

SailReal commented 1 year ago

@sixtsense do you have any news for us regarding this topic? As mentioned in https://github.com/pCloud/pcloud-sdk-java/issues/39#issuecomment-1315206005 and before the same question comes up here, the response of the file link to response of download call is 276ms. Can we somehow help to troubleshoot the problem?

georgi-neykov-hub commented 1 year ago

@sixtsense do you have any news for us regarding this topic? As mentioned in #39 (comment) and before the same question comes up here, the response of the file link to response of download call is 276ms. Can we somehow help to troubleshoot the problem?

@SailReal , I've commented on the issue with Cryptomator's behavior in the referenced issue, closing and moving the discussion there.

Play attention on the IP switching issue and cached connections from networks about to be terminated.

georgi-neykov-hub commented 1 year ago

Is the pCloud team on holiday? I have now experienced the error documented above multiple times when trying to access a folder via multiple Android phones in a Cryptomator vault in pCloud. The message displayed on the Android phones is "No network connection." The folder was accessible for months and then one day became inaccessible. On one occasion moving the folder to a different parent folder made the folder accessible again, but that workaround no longer works. Thankfully I can still access the folder on my desktop and laptop PCs via Cryptomator/Windows Explorer. This bug on Android needs to be fixed ASAP. I have a 10TB pCloud account, which I no longer trust to use until this problem is fixed. [Edit: grammar]

@LearningAsIGo71, nobody's on holiday, unfortunately. Please respect the fact that Cryptomator is a separate entity that has no relation to pCloud AG other than using an open source library that is mostly meant to give a head-start for developers wanting to interact with pCloud's API services. It does not aim to solve everyone's problems and use-cases, it should be as simple, unopinionated and as universal as possible to please all potential uses. In this regard, please keep discussions on 3rd-party (Cryptomator)-specific problems and bugs on their respective support boards and discussion panels.

On your issue, I've commented on the referenced issue in Cryptomator's GitHub repo and added a few hints on the somewhat strange "no network" messages appearing on the app. I've also contributed to Cryptomator's project by adding logic in the Android app that can handle the mentioned content link expiration in a sane manner, hopefully helping with your problems using the Cryptomator app for Android.