paulgessinger / swift-paperless

Native iOS app for interacting with a Paperless-ngx installation to manage documents
https://swift-paperless.gessinger.dev/
MIT License
371 stars 15 forks source link

Adding document via Share Sheet shows "0/0" #125

Closed Biepa closed 2 months ago

Biepa commented 3 months ago

When opening a PDF and select Paperless in the ShareSheet it shows "0 from 0" at the top. Is that a bug or meaning something else?

paperless

I'm on 1.5.0 (Build 99)

paulgessinger commented 3 months ago

Hm that looks strange indeed. Is this a single PDF? Does it fail to save the document when you hit save? Does it look the same when you open the PDF from the document picker inside the app?

Can you share the logs with me? It's possible to export the logs from inside the app itself, but for the share sheet, it might not contain all the information unfortunately, but it's a good place to start.

Biepa commented 3 months ago

I have seen this multiple times, so it's not related to a specific PDF.

I can only reproduce it currently when importing from the "Proton Mail" app. On a mail an attachment can be clicked and it opens in the iOS PDF viewer inside the app. I click on the share button there to import to Paperless.

The document is imported to Paperless without an issue.

Unfortunately I can't export the logs from mobile. The "collecting logs" part seems to work and when clicking "share logs" the share sheet opens but I can't get beyond that. :see_no_evil:

paulgessinger commented 3 months ago

Hey @Biepa,

That's almost even weirder 😅

The log export seems to also fail for me when trying to save to files (need to investigate that).

For me, sending an email with the logs works however, so in the meantime, can you try that?

I can also try to see if I can reproduce with a PDF attachment from the Proton app. It could be the file handover is somehow not doing quite the right thing there, although the fact that the import works indicates the PDF is accessible to the app.

Biepa commented 3 months ago

You are right, via mail worked.

It also shows not everytime with Proton Mail app. But I think at least the first time for every PDF.

I did a new import with this UI thing at 8:20 so I think there are no logs for this:

[8.8.2024, 8:18] [API] Getting connection from stored connection: http://user-5ea160f9@51f25ccf.example.com
[8.8.2024, 8:18] [General] Checking login status
[8.8.2024, 8:18] [API] Getting connection from stored connection: http://user-5ea160f9@51f25ccf.example.com
[8.8.2024, 8:18] [API] Initializing ApiRepository with connection <private> <private>
[8.8.2024, 8:18] [API] Getting backend versions
[8.8.2024, 8:18] [API] Backend version info: API version: 5, backend version: 2.11.2
[8.8.2024, 8:18] [General] Fetch all store request
[8.8.2024, 8:18] [General] Fetch all store
[8.8.2024, 8:18] [API] Correspondent API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] StoragePath API sequence fetch was empty
[8.8.2024, 8:18] [API] UserGroup API sequence fetch was empty
[8.8.2024, 8:18] [API] User API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] DocumentType API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] SavedView API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] Tag API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [General] Fetch all store complete
[8.8.2024, 8:18] [API] Getting connection from stored connection: http://user-5ea160f9@51f25ccf.example.com
[8.8.2024, 8:18] [API] Getting connection from stored connection: http://user-5ea160f9@51f25ccf.example.com
[8.8.2024, 8:18] [API] Getting document sequence for filter
[8.8.2024, 8:18] [General] App becomes active
[8.8.2024, 8:18] [API] Caught error fetching http://example.com/api/tasks/: Error Domain=NSURLErrorDomain Code=-999 "Abgebrochen" UserInfo={NSErrorFailingURLStringKey=http://example.com/api/tasks/, NSErrorFailingURLKey=http://example.com/api/tasks/, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <873275B6-2411-4F3B-9D50-4F41FC8B0D91>.<10>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <873275B6-2411-4F3B-9D50-4F41FC8B0D91>.<10>, NSLocalizedDescription=Abgebrochen}
[8.8.2024, 8:18] [API] Unable to load tasks: Error Domain=NSURLErrorDomain Code=-999 UserInfo={NSErrorFailingURLStringKey=<private>, NSErrorFailingURLKey=<private>, _NSURLErrorRelatedURLSessionTaskErrorKey=<private>, _NSURLErrorFailingURLSessionTaskErrorKey=<private>, NSLocalizedDescription=<private>}
[8.8.2024, 8:18] [General] Fetch all store request
[8.8.2024, 8:18] [General] Fetch all store
[8.8.2024, 8:18] [API] Correspondent API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] Tag API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] Document API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] UserGroup API sequence fetch was empty
[8.8.2024, 8:18] [API] DocumentType API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] SavedView API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] User API sequence has reached end (nextPage is nil)
[8.8.2024, 8:18] [API] StoragePath API sequence fetch was empty
[8.8.2024, 8:18] [API] Get thumbnail for document 1060
[8.8.2024, 8:18] [API] Get thumbnail for document 1059
[8.8.2024, 8:18] [API] Get thumbnail for document 1036
[8.8.2024, 8:18] [API] Get thumbnail for document 1053
[8.8.2024, 8:18] [API] Get thumbnail for document 1037
[8.8.2024, 8:18] [API] Get thumbnail for document 1021
[8.8.2024, 8:18] [API] Get thumbnail for document 1028
[8.8.2024, 8:18] [API] Get thumbnail for document 1035
[8.8.2024, 8:18] [API] Get thumbnail for document 1049
[8.8.2024, 8:18] [API] Get thumbnail for document 1050
[8.8.2024, 8:18] [API] Get thumbnail for document 1051
[8.8.2024, 8:18] [API] Get thumbnail for document 1052
[8.8.2024, 8:18] [API] Get thumbnail for document 912
[8.8.2024, 8:18] [API] Get thumbnail for document 919
[8.8.2024, 8:18] [General] Fetch all store complete
[8.8.2024, 8:18] [API] Get thumbnail for document 1053
[8.8.2024, 8:18] [API] Get thumbnail for document 1036
[8.8.2024, 8:18] [API] Get thumbnail for document 1059
[8.8.2024, 8:18] [API] Get thumbnail for document 1060
[8.8.2024, 8:18] [General] Requesting log export
[8.8.2024, 8:19] [API] Getting connection from stored connection: http://user-5ea160f9@51f25ccf.example.com
[8.8.2024, 8:19] [General] App becomes inactive
[8.8.2024, 8:19] [API] Getting connection from stored connection: http://user-5ea160f9@51f25ccf.example.com
[8.8.2024, 8:19] [General] App goes to background
[8.8.2024, 8:21] [API] Getting connection from stored connection: http://user-5ea160f9@51f25ccf.example.com
[8.8.2024, 8:21] [General] App becomes inactive
[8.8.2024, 8:21] [API] Getting connection from stored connection: http://user-5ea160f9@51f25ccf.example.com
[8.8.2024, 8:21] [General] App becomes active
[8.8.2024, 8:21] [General] Requesting log export
paulgessinger commented 3 months ago

Hey @Biepa, can you get in build 100 in TestFlight?

I added the ability to export logs directly from the share extension for debugging. Maybe you can give that a try?

Biepa commented 3 months ago

Here you go: ''' [11.8.2024, 22:40] [General] Paperless share extension viewDidLoad fired [11.8.2024, 22:40] [General] Receiving shared items [11.8.2024, 22:40] [General] Receiving 1 attachments [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [General] - #0 ~> [11.8.2024, 22:40] [General] Attachment has type PDF [11.8.2024, 22:40] [General] Loading item for type com.adobe.pdf [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] Initializing ApiRepository with connection http://example.com [11.8.2024, 22:40] [General] Did not get identities from keychain [11.8.2024, 22:40] [API] Getting backend versions [11.8.2024, 22:40] [General] Received url file:///private/var/mobile/Containers/Data/Application/D835D621-6C14-450A-A0ED-4EC45437E03D/tmp/files/7092F697-13C2-43B8-9C70-CCE1ED8F8C99/Feiertagsentsorgung%202024.pdf [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] Backend version info: API version: 5, backend version: 2.11.4 [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [General] Fetch all store request [11.8.2024, 22:40] [General] Fetch all store [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] Tag API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] DocumentType API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] StoragePath API sequence fetch was empty [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] UserGroup API sequence fetch was empty [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] User API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] SavedView API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] Correspondent API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [General] Fetch all store complete [11.8.2024, 22:40] [General] Fetch all store request [11.8.2024, 22:40] [General] Fetch all store [11.8.2024, 22:40] [API] Correspondent API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] DocumentType API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] Tag API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] User API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] StoragePath API sequence fetch was empty [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] UserGroup API sequence fetch was empty [11.8.2024, 22:40] [API] SavedView API sequence has reached end (nextPage is nil) [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [General] Fetch all store complete [11.8.2024, 22:40] [General] Paperless share extension viewDidLoad fired [11.8.2024, 22:40] [General] Receiving shared items [11.8.2024, 22:40] [General] Receiving 1 attachments [11.8.2024, 22:40] [General] - #0 ~> [11.8.2024, 22:40] [General] Attachment has type PDF [11.8.2024, 22:40] [General] Loading item for type com.adobe.pdf [11.8.2024, 22:40] [General] Received url file:///private/var/mobile/Containers/Data/Application/D835D621-6C14-450A-A0ED-4EC45437E03D/tmp/files/19302CBD-4DC6-463B-88A8-BE2DEB8A34C3/Rechnung-nc-3467856.pdf [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [API] Initializing ApiRepository with connection http://example.com [11.8.2024, 22:40] [General] Did not get identities from keychain [11.8.2024, 22:40] [General] Fetch all store request [11.8.2024, 22:40] [API] Getting backend versions [11.8.2024, 22:40] [General] Fetch all store [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [General] Unable to get current user: Error Domain=ShareExtension.NullRepository.NotImplemented Code=1 [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [General] Fetch all store complete [11.8.2024, 22:40] [API] Backend version info: API version: 5, backend version: 2.11.4 [11.8.2024, 22:40] [API] Getting connection from stored connection: http://user-5da065df@440b2967.example.com [11.8.2024, 22:40] [General] Requesting log export '''

No idea how to do a code block on mobile 😅. The "rechnung" file had the mentioned issue.

Biepa commented 3 months ago

@paulgessinger Also was this today by using the default mail app from apple.

paulgessinger commented 3 months ago

Ok the logs don't really indicate anything going wrong.

I'll add some more logging statements and try to reproduce it.

paulgessinger commented 3 months ago

I have somewhat of a workaround in build 102 on TestFlight now. Maybe you can try that out when you get the chance, and send me another set of logs (I added some more).

Biepa commented 3 months ago

I couldn't reproduce this in the last few days. I tried with different documents and apps. Did your changes possibly fix it?

I can try some more days though.

Biepa commented 2 months ago

@paulgessinger Haven't experienced this in the last week while importing multiple documents. I'm fine with closing for now and will come back if it comes up again.