Skip to content

Commit

Permalink
bypass update for raw image requests
Browse files Browse the repository at this point in the history
  • Loading branch information
damongolding committed Jul 30, 2024
1 parent b5aaffb commit 8d4ddb4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,13 @@ func NewImage(c echo.Context) error {

kioskVersionHeader := c.Request().Header.Get("kiosk-version")
requestId := fmt.Sprintf("[%s]", c.Response().Header().Get(echo.HeaderXRequestID))
requestingRawImage := c.Request().URL.Query().Has("raw")

// create a copy of the global config to use with this instance
instanceConfig := baseConfig

// If kiosk version on client and server do not match refresh client
if KioskVersion != kioskVersionHeader {
// If kiosk version on client and server do not match refresh client. Pypass if requestingRawImage is set
if !requestingRawImage && KioskVersion != kioskVersionHeader {
c.Response().Header().Set("HX-Refresh", "true")
return c.String(http.StatusTemporaryRedirect, "")
}
Expand Down Expand Up @@ -139,7 +140,7 @@ func NewImage(c echo.Context) error {
log.Debug(requestId, "Got image in", time.Since(imageGet).Seconds())

// if user wants the raw image data send it
if c.Request().URL.Query().Has("raw") {
if requestingRawImage {
return c.Blob(http.StatusOK, immichImage.OriginalMimeType, imgBytes)
}

Expand Down

0 comments on commit 8d4ddb4

Please sign in to comment.