updated linting testing

This commit is contained in:
Graham Steffaniak committed 2025-09-09 18:36:13 -05:00
1 parent 5e79faefa1
commit e8a95cb3cf
4 files changed
+11 -55

No files matched your search

+11 -9
View File
@@ -48,7 +48,7 @@ func (s *ImageService) GetImageDimensions(imagePath string) (width, height int,
probeCmd.Stdout = &probeOut
probeCmd.Stderr = &probeErr
if err := probeCmd.Run(); err != nil {
if err = probeCmd.Run(); err != nil {
fmt.Printf("❌ IMAGE SERVICE: ffprobe failed with error: %v\n", err)
fmt.Printf("❌ IMAGE SERVICE: ffprobe stderr: %s\n", probeErr.String())
return 0, 0, fmt.Errorf("ffprobe command failed on image file '%s': %w", imagePath, err)
@@ -114,13 +114,14 @@ func (s *ImageService) ConvertHEICToJPEG(heicPath string, targetWidth, targetHei
var gridErr bytes.Buffer
gridCmd.Stdout = &gridOut
gridCmd.Stderr = &gridErr
gridCmd.Run() // Don't check error, we're just extracting info
_ = gridCmd.Run() // Don't check error, we're just extracting info
traceOutput := gridErr.String()
fmt.Printf("📊 IMAGE SERVICE: Got trace output: %d bytes\n", len(traceOutput))
// Parse grid dimensions from trace output
var gridCols, gridRows int = 8, 6 // Default fallback
var gridCols, gridRows = 8, 6 // Default fallback
var val int
// Look for grid_row and grid_col in trace output
lines := strings.Split(traceOutput, "\n")
@@ -129,7 +130,7 @@ func (s *ImageService) ConvertHEICToJPEG(heicPath string, targetWidth, targetHei
// Try to extract grid_row value
if parts := strings.Split(line, "grid_row"); len(parts) > 1 {
if matches := strings.Fields(parts[1]); len(matches) > 0 {
if val, err := strconv.Atoi(strings.Trim(matches[0], " :=")); err == nil {
if val, err = strconv.Atoi(strings.Trim(matches[0], " :=")); err == nil {
gridRows = val + 1 // HEIC grid_row is 0-based
fmt.Printf("📐 IMAGE SERVICE: Parsed grid_row: %d (rows: %d)\n", val, gridRows)
}
@@ -140,7 +141,7 @@ func (s *ImageService) ConvertHEICToJPEG(heicPath string, targetWidth, targetHei
// Try to extract grid_col value
if parts := strings.Split(line, "grid_col"); len(parts) > 1 {
if matches := strings.Fields(parts[1]); len(matches) > 0 {
if val, err := strconv.Atoi(strings.Trim(matches[0], " :=")); err == nil {
if val, err = strconv.Atoi(strings.Trim(matches[0], " :=")); err == nil {
gridCols = val + 1 // HEIC grid_col is 0-based
fmt.Printf("📐 IMAGE SERVICE: Parsed grid_col: %d (cols: %d)\n", val, gridCols)
}
@@ -177,7 +178,7 @@ func (s *ImageService) ConvertHEICToJPEG(heicPath string, targetWidth, targetHei
fmt.Printf("🚀 IMAGE SERVICE: Running tile extraction: %s %s\n", s.ffmpegPath, strings.Join(extractCmd.Args[1:], " "))
if err := extractCmd.Run(); err != nil {
if err = extractCmd.Run(); err != nil {
fmt.Printf("❌ IMAGE SERVICE: Tile extraction failed: %v\n", err)
fmt.Printf("❌ IMAGE SERVICE: stderr: %s\n", extractErr.String())
return nil, fmt.Errorf("tile extraction failed: %w", err)
@@ -202,10 +203,11 @@ func (s *ImageService) ConvertHEICToJPEG(heicPath string, targetWidth, targetHei
for i := 1; i <= len(files); i++ { // Start from 1 to skip output_0.png
sourceFile := filepath.Join(tempDir, fmt.Sprintf("output_%d.png", i))
if info, err := os.Stat(sourceFile); err == nil && info.Size() > 500 {
var info os.FileInfo
if info, err = os.Stat(sourceFile); err == nil && info.Size() > 500 {
// This is a valid tile, rename it to sequential format
targetFile := filepath.Join(tempDir, fmt.Sprintf("tile_%03d.png", tileIndex))
if err := os.Rename(sourceFile, targetFile); err != nil {
if err = os.Rename(sourceFile, targetFile); err != nil {
fmt.Printf("⚠️ IMAGE SERVICE: Failed to rename %s: %v\n", filepath.Base(sourceFile), err)
continue
}
@@ -267,7 +269,7 @@ func (s *ImageService) ConvertHEICToJPEG(heicPath string, targetWidth, targetHei
fmt.Printf("🚀 IMAGE SERVICE: Running tile merge: %s %s\n", s.ffmpegPath, strings.Join(mergeCmd.Args[1:], " "))
if err := mergeCmd.Run(); err != nil {
if err = mergeCmd.Run(); err != nil {
fmt.Printf("❌ IMAGE SERVICE: Tile merge failed: %v\n", err)
fmt.Printf("❌ IMAGE SERVICE: stderr: %s\n", mergeErr.String())
return nil, fmt.Errorf("tile merge failed: %w", err)
-40
View File
@@ -294,43 +294,3 @@ func checkExecutable(providedPath, execName string) (string, error) {
return finalPath, err
}
// convertHEICToJPEGWithSize converts a HEIC file to JPEG format with proper size and quality settings
func (s *Service) convertHEICToJPEGWithSize(filePath string, previewSize string) ([]byte, error) {
file, err := os.Open(filePath)
if err != nil {
return nil, fmt.Errorf("failed to open HEIC file: %w", err)
}
defer file.Close()
// Determine target dimensions and quality based on preview size
var width, height int
var options []Option
switch previewSize {
case "large":
width, height = 640, 640
options = []Option{WithMode(ResizeModeFit), WithQuality(QualityHigh), WithFormat(FormatJpeg)}
case "small":
width, height = 256, 256
options = []Option{WithMode(ResizeModeFit), WithQuality(QualityMedium), WithFormat(FormatJpeg)}
case "original":
// For original size HEIC, use very large dimensions to preserve original size
// The Fit mode will maintain aspect ratio and orientation
width, height = 8192, 8192
options = []Option{WithMode(ResizeModeFit), WithQuality(QualityHigh), WithFormat(FormatJpeg)}
default:
return nil, ErrUnsupportedFormat
}
// Pre-allocate buffer with reasonable size for HEIC->JPEG conversion
output := bytes.NewBuffer(make([]byte, 0, 256*1024))
// Convert HEIC to JPEG with proper dimensions, quality, and orientation handling
err = s.Resize(file, width, height, output, options...)
if err != nil {
return nil, fmt.Errorf("failed to convert HEIC to JPEG: %w", err)
}
return output.Bytes(), nil
}
-5
View File
@@ -1,11 +1,6 @@
import { reactive } from 'vue';
import { detectLocale } from "@/i18n";
function loadDisplayPreferences(username) {
const allPreferences = JSON.parse(localStorage.getItem("displayPreferences") || "{}");
return allPreferences[username] || {};
}
export const state = reactive({
tooltip: {
show: false,
-1
View File
@@ -19,7 +19,6 @@ async function globalSetup() {
await page.locator('button[aria-label="File-Actions"]').click();
await page.locator('button[aria-label="Share"]').click();
await page.locator('button[aria-label="Share-Confirm"]').click();
await page.waitForResponse(response => response.status() === 200);
await expect(page.locator("div[aria-label='share-prompt'] .card-content table tbody tr:not(:has(th))")).toHaveCount(1);
const shareHash = await page.locator("div[aria-label='share-prompt'] .card-content table tbody tr:not(:has(th)) td").first().textContent();
if (!shareHash) {