tenseleyflow/shithub / 944629e

Browse files

Fix editor lint findings

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
944629e7af3564a80c5ada389697884efdd2787c
Parents
5ac31a3
Tree
9ba9341

2 changed files

StatusFile+-
M internal/repos/webedit/webedit.go 1 3
M internal/web/handlers/repo/editor.go 4 0
internal/repos/webedit/webedit.gomodified
@@ -534,9 +534,7 @@ func enqueuePushProcess(ctx context.Context, pool *pgxpool.Pool, repoID, actorUs
534534
 	}{PushEventID: event.ID}, worker.EnqueueOptions{}); err != nil {
535535
 		return 0, err
536536
 	}
537
-	if err := worker.Notify(ctx, tx); err != nil {
538
-		// Workers also poll. Keep the commit path live if NOTIFY fails.
539
-	}
537
+	_ = worker.Notify(ctx, tx) // Workers also poll; keep the commit path live if NOTIFY fails.
540538
 	if err := tx.Commit(ctx); err != nil {
541539
 		return 0, fmt.Errorf("webedit: commit push event tx: %w", err)
542540
 	}
internal/web/handlers/repo/editor.gomodified
@@ -214,6 +214,10 @@ func (h *Handlers) codeUploadSubmit(w http.ResponseWriter, r *http.Request) {
214214
 		return
215215
 	}
216216
 	r.Body = http.MaxBytesReader(w, r.Body, webedit.MaxUploadBytes)
217
+	// MaxBytesReader above caps the full multipart request body before
218
+	// ParseMultipartForm can spill parts to memory/disk.
219
+	//
220
+	//nolint:gosec // G120: request body is capped by MaxBytesReader.
217221
 	if err := r.ParseMultipartForm(webedit.MaxUploadBytes); err != nil {
218222
 		data := h.editorData(r, cc, "upload", "", "")
219223
 		data.Error = "The uploaded files are too large or could not be read."