rubyforgood / rubyforgood/skillrx-beacon

File Download Service

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cross-app sync
Dominant language
HTML
Stars
4
Forks
0
PR merge metrics
No merged PRs in 30d

Description

GET /api/v1/files/{id} with resume support

  • Create FileDownloader service:
class FileDownloader
  def download(file_id, expected_checksum:, resume_from: 0)
    # Downloads to temp file
    # Supports Range header for resume
    # Returns path to downloaded file
  end
end
  • Download to temp directory (tmp/downloads/)
  • Track partial download progress for resume capability
  • Return downloaded file path for attachment

Verify downloaded files match manifest checksums

  • Create ChecksumVerifier service:
class ChecksumVerifier
  def verify!(file_path, expected_sha256)
    actual = Digest::SHA256.file(file_path).hexdigest
    expected = expected_sha256.delete_prefix("sha256:")
    raise ChecksumMismatchError unless actual == expected
  end
end
  • Consider using MD5 since active storage uses MD5 for checksums
  • Integrate verification before ActiveStorage attachment
  • On mismatch: delete file, retry download (up to 3 attempts)

Ensure proper ActiveStorage setup for offline operation

  • Verify config/storage.yml uses local disk:
    local:
    service: Disk
    root: <%= Rails.root.join("storage") %>
  • Set in config/environments/production.rb:
    config.active_storage.service = :local
  • Configure blob cleanup: old blobs purged when TopicFile destroyed
  • Add storage/ to backup strategy

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading config/storage.yml and config/environments/production.rb, then locate the FileDownloader, ChecksumVerifier, ActiveStorage attachment flow, and TopicFile model. Done means downloads resume from partial files, checksum failures clean up and retry, local storage is configured for offline use, and TopicFile cleanup and backup requirements are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.