Skip to content

Commit

Permalink
emergancy fix for replacement up.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Sep 23, 2024
1 parent 4b9da05 commit e752ee6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
5 changes: 3 additions & 2 deletions handler/app/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,16 @@ func artifacts(c echo.Context, db *sql.DB, uri string, page int) error {
return DatabaseErr(c, errs, err)
}
data["stats"] = d
lastPage := math.Ceil(float64(sum) / float64(limit))
if len(r) == 0 {
if err = c.Render(http.StatusOK, name, data); err != nil {
return InternalErr(c, errs, err)
}
return nil
}
lastPage := math.Ceil(float64(sum) / float64(limit))
if page > int(lastPage) {
return Page404(c, uri, strconv.Itoa(page))
i := strconv.Itoa(page)
return Page404(c, uri, i)
}
const pages = 2
data["Pagination"] = Pagination{
Expand Down
3 changes: 0 additions & 3 deletions handler/htmx/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,6 @@ func UploadReplacement(c echo.Context, db *sql.DB, downloadDir, extraDir string)
return c.HTML(http.StatusInternalServerError, "The database commit failed")
}
repack := filepath.Join(extraDir, up.unid+".zip")
if err := command.UncontrolledPath(repack); err != nil {
return fmt.Errorf("upload replacement %w", err)
}
defer os.Remove(repack)
if mkc, err := helper.MkContent(abs); err == nil {
defer os.RemoveAll(mkc)
Expand Down
6 changes: 0 additions & 6 deletions internal/command/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@ func (dir Dirs) PictureImager(debug *zap.SugaredLogger, src, unid string) error
// can be used by the ANSILOVE command to create a PNG image. 80 columns and 29 rows are
// works well with a 400x400 pixel thumbnail.
func TextCrop(src, dst string) error {
if err := UncontrolledPath(src); err != nil {
return fmt.Errorf("text crop %w", err)
}
srcFile, err := os.Open(src)
if err != nil {
return fmt.Errorf("text crop open %w", err)
Expand Down Expand Up @@ -386,9 +383,6 @@ func textCropper(src, unid string) (string, error) {
// A webp thumbnail image is also created and copied to the thumbnail directory.
// If the amigaFont is true, the image is created using an Amiga Topaz+ font.
func (dir Dirs) TextImager(debug *zap.SugaredLogger, src, unid string, amigaFont bool) error {
if err := UncontrolledPath(src); err != nil {
return fmt.Errorf("dirs text imager %w", err)
}
if amigaFont {
return dir.textAmigaImager(debug, src, unid)
}
Expand Down

0 comments on commit e752ee6

Please sign in to comment.