nextcloud / ios

📱 Nextcloud iOS App
https://itunes.apple.com/us/app/nextcloud/id1125420102
GNU General Public License v3.0
1.96k stars 881 forks source link

shared links from folder with emoji cause ios app to close #996

Open ChildLearningClub opened 4 years ago

ChildLearningClub commented 4 years ago

Steps to reproduce

1. 2. 3.

Expected behaviour

Tell us what should happen

Actual behaviour

Tell us what happens instead

Server configuration

Operating system:

Web server:

Database:

PHP version:

Nextcloud version: (see Nextcloud admin page)

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from:

Signing status:

Signing status ``` Login as admin user into your Nextcloud and access http://example.com/index.php/settings/integrity/failed paste the results here. ```

List of activated apps:

App list ``` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your Nextcloud installation folder ```

Nextcloud configuration:

Config report ``` If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your Nextcloud installation folder or Insert your config.php content here. Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …) ```

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

LDAP config ``` With access to your command line run e.g.: sudo -u www-data php occ ldap:show-config from within your Nextcloud installation folder Without access to your command line download the data/owncloud.db to your local computer or access your SQL server remotely and run the select query: SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap'; Eventually replace sensitive data as the name/IP-address of your LDAP server or groups. ```

Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log ``` Insert your webserver log here ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` Insert your Nextcloud log here ```

Browser log

Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```
blackivory86 commented 4 years ago

When creating the share link for a file in the folder with an emoji the app crashes with the following error:

2020-01-01 19:56:44.824872+0100 Nextcloud[26419:298959] *** Terminating app due to uncaught exception 'RLMException', reason: 'Attempted to insert null into non-nullable column
Exception backtrace:
0   Realm                               0x000000010cc6cefe _ZN5realm10LogicErrorC1ENS0_9ErrorKindE + 62
1   Realm                               0x000000010cf6e78e _ZN5realm5Table3setINS_10StringDataEEEvmmT_b + 350
2   Realm                               0x000000010cca42ee _ZN5realm6Object23set_property_value_implIU8__strongP11objc_object18RLMAccessorContextEEvRT0_RKNS_8PropertyET_NS_12CreatePolicyEb + 1646
3   Realm                               0x000000010ccc1f6a _ZN5realm6Object6createIU8__strongP11objc_object18RLMAccessorContextEES0_RT0_RKNSt3__110shared_ptrINS_5RealmEEERKNS_12ObjectSchemaET_NS_12CreatePolicyEmPNS_8BasicRowINS_5TableEEE + 1214
4   Realm                               0x000000010ccc1996 RLMAddObjectToRealm + 385
5   Nextcloud                           0x000000010b3610fa $s9Nextcloud16NCManageDatabaseC8addShare7account9activeUrl5itemsSayAA05tableE0CGSS_SSSaySo11OCSharedDtoCGtF + 11786
6   Nextcloud                           0x000000010b376528 $s9Nextcloud17NCShareNetworkingC5share8password10permission12hideDownloadySS_SiSbtFySSSg_AHSitcfU_yAH_SayypGSgAHSitcfU_ + 952
7   Nextcloud                           0x000000010b37b006 $s9Nextcloud17NCShareNetworkingC5share8password10permission12hideDownloadySS_SiSbtFySSSg_AHSitcfU_yAH_SayypGSgAHSitcfU_TA + 22
8   Nextcloud                           0x000000010b1d7b0f $sSSSgSayypGSgAASiIeggggy_So8NSStringCSgSo7NSArrayCSgAFSiIeyByyyy_TR + 527
9   Nextcloud                           0x000000010adcd3ee __53-[OCNetworking readShareWithAccount:path:completion:]_block_invoke + 158
10  Nextcloud                           0x000000010aee6beb __92-[OCCommunication readSharedByServer:andPath:onCommunication:successRequest:failureRequest:]_block_invoke + 331
11  Nextcloud                           0x000000010af33670 __74-[OCWebDAVClient mr_operationWithRequest:onCommunication:success:failure:]_block_invoke + 144
12  AFNetworking                        0x000000010c73fa9f __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.106 + 140
13  libdispatch.dylib                   0x000000010e96edd4 _dispatch_call_block_and_release + 12
14  libdispatch.dylib                   0x000000010e96fd48 _dispatch_client_callout + 8
15  libdispatch.dylib                   0x000000010e97dadb _dispatch_main_queue_callback_4CF + 721
16  CoreFoundation                      0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
17  CoreFoundation                      0x00007fff23bceca9 __CFRunLoopRun + 2329
18  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
19  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
20  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
21  Nextcloud                           0x000000010afbb180 main + 112
22  libdyld.dylib                       0x00007fff5227ec25 start + 1'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    2   Realm                               0x000000010ccc1a63 RLMAddObjectToRealm + 590
    3   Nextcloud                           0x000000010b3610fa $s9Nextcloud16NCManageDatabaseC8addShare7account9activeUrl5itemsSayAA05tableE0CGSS_SSSaySo11OCSharedDtoCGtF + 11786
    4   Nextcloud                           0x000000010b376528 $s9Nextcloud17NCShareNetworkingC5share8password10permission12hideDownloadySS_SiSbtFySSSg_AHSitcfU_yAH_SayypGSgAHSitcfU_ + 952
    5   Nextcloud                           0x000000010b37b006 $s9Nextcloud17NCShareNetworkingC5share8password10permission12hideDownloadySS_SiSbtFySSSg_AHSitcfU_yAH_SayypGSgAHSitcfU_TA + 22
    6   Nextcloud                           0x000000010b1d7b0f $sSSSgSayypGSgAASiIeggggy_So8NSStringCSgSo7NSArrayCSgAFSiIeyByyyy_TR + 527
    7   Nextcloud                           0x000000010adcd3ee __53-[OCNetworking readShareWithAccount:path:completion:]_block_invoke + 158
    8   Nextcloud                           0x000000010aee6beb __92-[OCCommunication readSharedByServer:andPath:onCommunication:successRequest:failureRequest:]_block_invoke + 331
    9   Nextcloud                           0x000000010af33670 __74-[OCWebDAVClient mr_operationWithRequest:onCommunication:success:failure:]_block_invoke + 144
    10  AFNetworking                        0x000000010c73fa9f __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.106 + 140
    11  libdispatch.dylib                   0x000000010e96edd4 _dispatch_call_block_and_release + 12
    12  libdispatch.dylib                   0x000000010e96fd48 _dispatch_client_callout + 8
    13  libdispatch.dylib                   0x000000010e97dadb _dispatch_main_queue_callback_4CF + 721
    14  CoreFoundation                      0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    15  CoreFoundation                      0x00007fff23bceca9 __CFRunLoopRun + 2329
    16  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
    17  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
    18  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
    19  Nextcloud                           0x000000010afbb180 main + 112
    20  libdyld.dylib                       0x00007fff5227ec25 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
blackivory86 commented 4 years ago

App crashed on every start now that the share-link was created! And this crash "syncs" across iOS devices

ChildLearningClub commented 4 years ago

Thanks for adding more detail @blackivory86 looking back at my original post I’m not sure why I wasn’t more thorough. Hard to fix things with little to go off of.

blackivory86 commented 4 years ago

Did some more research:

Seems like in NCManageDatabase.addShare(account:, activeUrl:, items: ) the serverURL parameter is off with emojis in the path. The crash can be fixed by replacing var serverUrl = NSString(string: fullPath).substring(to: (fullPath.count - fileName.count - 1)) with var serverUrl = NSString(string: fullPath).deletingLastPathComponent But this seems to throw off other parts of the logic. The UI does not show the file as "shared" afterwards.