merge: integrate media workflow fixes

This commit is contained in:
ShukeBta
2026-06-25 12:45:45 +08:00
584 changed files with 62862 additions and 41863 deletions
+29
View File
@@ -0,0 +1,29 @@
package handler
import (
"context"
"errors"
"net/http"
"github.com/gin-gonic/gin"
)
const statusClientClosedRequest = 499
func requestContextCanceled(c *gin.Context, err error) bool {
if errors.Is(err, context.Canceled) {
return true
}
if c == nil || c.Request == nil {
return false
}
return errors.Is(c.Request.Context().Err(), context.Canceled)
}
func writeInternalOrCanceled(c *gin.Context, err error) {
if requestContextCanceled(c, err) {
c.AbortWithStatus(statusClientClosedRequest)
return
}
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
}