]> Untitled Git - lemmy.git/commitdiff
Coerce empty post form to undefined. Fixes #602
authorDessalines <tyhou13@gmx.com>
Mon, 22 Jun 2020 23:27:42 +0000 (19:27 -0400)
committerDessalines <tyhou13@gmx.com>
Mon, 22 Jun 2020 23:27:42 +0000 (19:27 -0400)
ui/src/components/post-form.tsx

index ee805a7c04027d3b909ca50a06fcbb5ad1e153d3..c507ab3e700378c83bfb82916276c61aa032ae03 100644 (file)
@@ -408,6 +408,12 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
 
   handlePostSubmit(i: PostForm, event: any) {
     event.preventDefault();
+
+    // Coerce empty url string to undefined
+    if (i.state.postForm.url && i.state.postForm.url === '') {
+      i.state.postForm.url = undefined;
+    }
+
     if (i.props.post) {
       WebSocketService.Instance.editPost(i.state.postForm);
     } else {