Skip to content

Missing upload log for uncompressed files when compression flag is enabled #451

@Bugfire

Description

@Bugfire

Thank you for this excellent gem! I've been using it extensively and find it very helpful.

I've noticed an issue in the upload_file method:

if config.compression
compressed_name = "#{path}/#{f}.#{config.compression}"
# `File.extname` returns value with `.` prefix, `config.compression` contains value without `.`
if File.extname(f)[1..-1] == config.compression
# Don't bother uploading compressed assets if we are in compression mode
# as we will overwrite file.css with file.css.gz if it exists.
log "Ignoring: #{f}"
ignore = true
elsif File.exist?(compressed_name)

When config.compression is defined and the file doesn't satisfy the first if or elsif conditions, there's no log output for the upload.

Current behavior:

  • Files that don't have corresponding compressed versions (like PNG files) are uploaded silently
  • This makes it difficult to track which files are being processed during log analysis

Expected behavior:

  • To maintain consistency with the case when compression is not configured, it would be helpful to always output log "Uploading: #{f}" for files that are actually uploaded.

Suggested fix:

  • Add an else clause to ensure logging occurs for all uploaded files:
if config.compression
  # existing logic...
  if File.extname(f)[1..-1] == config.compression
    # existing logic...
  elsif File.exist?(compressed_name)
    # existing logic...
  else
    log "Uploading: #{f}"  # Add this line
  end
end

This would greatly improve log analysis capabilities.

Thank you for your consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions