@@ -469,6 +469,14 @@ func addLinkHandler(w http.ResponseWriter, r *http.Request) {
469469 http .Error (w , "Bad Request" , http .StatusBadRequest )
470470 return
471471 }
472+ if len (newLink .Url ) == 0 {
473+ http .Error (w , "Url required" , http .StatusBadRequest )
474+ return
475+ }
476+ if len (newLink .Category ) == 0 {
477+ http .Error (w , "Category required" , http .StatusBadRequest )
478+ return
479+ }
472480 nav , err := loadNavigation ()
473481 if err != nil {
474482 http .Error (w , "Internal Server Error" , http .StatusInternalServerError )
@@ -495,6 +503,14 @@ func updateLinkHandler(w http.ResponseWriter, r *http.Request) {
495503 http .Error (w , "Bad Request" , http .StatusBadRequest )
496504 return
497505 }
506+ if len (updatedLink .Url ) == 0 {
507+ http .Error (w , "Url required" , http .StatusBadRequest )
508+ return
509+ }
510+ if len (updatedLink .Category ) == 0 {
511+ http .Error (w , "Category required" , http .StatusBadRequest )
512+ return
513+ }
498514 var index int
499515 fmt .Sscanf (r .URL .Path , "/navigation/update/%d" , & index )
500516 nav , err := loadNavigation ()
0 commit comments