apps-android-commons
apps-android-commons copied to clipboard
Remove leading and trailing spaces in title
When adding new images through the app it happens that the caption ends with a space. This is then used for title/filename and produces ugly links. Please run a .trim() before uploading.
Thanks for reporting! Would you have a link to such an uploaded image (with extra spaces)?
I'm new to android development and is willing to handle this issue with my hardest try :) Considering that I'm not that familiar with Android, If I cannot work it out I'll post my failure attempts below.
@U81-A Thanks! Sure, please let us know how it goes, success or failure :-) Ideally please upload an APK somewhere so that @NotSoImportant can test it.
👍 Is there any procedure how to do test uploads. E.g. to a certain category?
@NotSoImportant Not really, just upload encyclopedy-worthy pictures that you took :-) If you have none on your phone, you can use some of the pictures I took: https://drive.google.com/drive/folders/1T5wfM16qb78XCvnf1Zunww4neg8BXJj6?usp=sharing
@NotSoImportant Not really, just upload encyclopedy-worthy pictures that you took :-) If you have none on your phone, you can use some of the pictures I took: https://drive.google.com/drive/folders/1T5wfM16qb78XCvnf1Zunww4neg8BXJj6?usp=sharing
Thanks for the shared link, I just went through the developer document and gonna find proper pictures for uploading and testing
I'm back again, and I went through the code but not quite clear which particular part of the code is responsible for taking in the user's input of the caption :(
I also thought that to make the file names and links look nicer, is it possible to only do a trim before uploading the file? (I'll try that and other methods after I found the relevant code block)
Trimming should be done as early as possible. Please place many breakpoints to see which one gets hit after filling the caption. Good luck! 🙂
See also #4395.
@U81-A are u still working on this one ?
In 3.1.1 (or with potential server changes) the situation now is worse. Upload finally fails, but without any indication why. After retry subsequently fails as well. When re-adding the same text and picture, but this time description not ending with a whitespace it is successful.
Related: #4676
@NotSoImportant can I know more about this issue ?
Sure, what do you want to know?
When using autocomplete to type a title, my keyboard will add a trailing whitespace (which is not obviously recognized by the user). When trying to upload it will fail or hang without any proper error message.
@NotSoImportant I am interested in working on this issue and would ensure that the string is trimmed before reaching the backend. Please can you assign this issue to me?
@shubhamshah14102 It is yours, thanks! Please let us know about your progress every few days 🙂
Hi @nicolas-raoul Can I take this up?
@shubhamshah14102 Any progress on this?
@bhavanagarlapati Please take one issue at a time. Do not hesitate to come back to this one after sending a pull request for your currently assigned one. :-)
I'm helping someone learn the app, and they're hitting this bug quite often because they inadvertently add a space at the end of the caption. This means they hit the titleblacklist-custom-space issue (because the filename ends up as North Cottesloe beach .jpg):
2023-01-07 09:32:29,004 [ERROR] [file-logging-thread-1] [UploadClient] : Error in uploading file from stash
org.wikipedia.dataclient.mwapi.MwException: ⧼titleblacklist-custom-space⧽
2023-01-07 09:32:29,005 [ERROR] [file-logging-thread-1] [UploadWorker] : java.lang.NullPointerException: The supplied value is null
at io.reactivex.internal.operators.observable.ObservableOnErrorReturn$OnErrorReturnObserver.onError(ObservableOnErrorReturn.java:80)
at io.reactivex.internal.observers.BasicFuseableObserver.onError(BasicFuseableObserver.java:100)
at io.reactivex.internal.observers.BasicFuseableObserver.fail(BasicFuseableObserver.java:110)
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:59)
at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:51)
at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:37)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:44)
at io.reactivex.Observable.subscribe(Observable.java:12267)
at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
at io.reactivex.Observable.subscribe(Observable.java:12267)
at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
at io.reactivex.Observable.subscribe(Observable.java:12267)
at io.reactivex.internal.operators.observable.ObservableOnErrorReturn.subscribeActual(ObservableOnErrorReturn.java:31)
at io.reactivex.Observable.subscribe(Observable.java:12267)
at io.reactivex.internal.operators.observable.ObservableSingleMaybe.subscribeActual(ObservableSingleMaybe.java:31)
at io.reactivex.Maybe.subscribe(Maybe.java:4290)
at io.reactivex.Maybe.blockingGet(Maybe.java:2320)
at io.reactivex.Observable.blockingSingle(Observable.java:5381)
at fr.free.nrw.commons.upload.worker.UploadWorker.uploadContribution(UploadWorker.kt:300)
at fr.free.nrw.commons.upload.worker.UploadWorker.access$uploadContribution(UploadWorker.kt:48)
at fr.free.nrw.commons.upload.worker.UploadWorker$doWork$2$invokeSuspend$$inlined$map$1$2.emit(Collect.kt:148)
at kotlinx.coroutines.flow.FlowKt__BuildersKt$asFlow$$inlined$unsafeFlow$3.collect(SafeCollector.common.kt:115)
at fr.free.nrw.commons.upload.worker.UploadWorker$doWork$2$invokeSuspend$$inlined$map$1.collect(SafeCollector.common.kt:114)
at kotlinx.coroutines.flow.FlowKt__CollectKt.collect(Collect.kt:30)
at kotlinx.coroutines.flow.FlowKt.collect(Unknown Source:1)
at fr.free.nrw.commons.upload.worker.UploadWorker$doWork$2.invokeSuspend(UploadWorker.kt:218)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.Exception: titleblacklist-custom-space
at fr.free.nrw.commons.upload.UploadClient.lambda$uploadFileFromStash$3$UploadClient(UploadClient.java:227)
at fr.free.nrw.commons.upload.-$$Lambda$UploadClient$-xVSLroq3t059tyyfYuDUQukbVk.apply(Unknown Source:4)
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:57)
... 28 more
2023-01-07 09:32:29,006 [ERROR] [file-logging-thread-1] [UploadWorker] : Upload from stash failed for contribution : North Cottesloe beach .jpg
Hi, I'm a new contributor here and would like to try my hand at this issue. Can it be assigned to me?
@chan-j-d Yes thanks, please let us know about your progress every few days 🙂