Skip to content

Commit 18b0517

Browse files
Vivek Maskaramisaochan
authored andcommitted
Fix crash while uploading image with whitespace title (commons-app#1636)
1 parent 1dc0a7c commit 18b0517

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/src/main/java/fr/free/nrw/commons/upload/SingleUploadFragment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
7474
//What happens when the 'submit' icon is tapped
7575
case R.id.menu_upload_single:
7676

77-
if (titleEdit.getText().toString().isEmpty()) {
77+
if (titleEdit.getText().toString().trim().isEmpty()) {
7878
Toast.makeText(getContext(), R.string.add_title_toast, Toast.LENGTH_LONG).show();
7979
return false;
8080
}
8181

82-
String title = titleEdit.getText().toString();
83-
String desc = descEdit.getText().toString();
82+
String title = titleEdit.getText().toString().trim();
83+
String desc = descEdit.getText().toString().trim();
8484

8585
//Save the title/desc in short-lived cache so next time this fragment is loaded, we can access these
8686
prefs.edit()

0 commit comments

Comments
 (0)