Skip to content

Conversation

tommyxchow
Copy link
Owner

Summary

  • handle only files when purging cache
  • compute relative paths correctly before deletion

Testing

  • flutter test (fails: command not found)

https://chatgpt.com/codex/tasks/task_e_684de397f224832c902db542c8e6d435

Copy link

vercel bot commented Jun 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
frostyapp ⬜️ Ignored (Inspect) Visit Preview Jun 14, 2025 9:09pm

@tommyxchow tommyxchow requested a review from Copilot June 14, 2025 21:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to fix an issue with orphaned cache files by ensuring only file objects are processed and by correctly computing relative paths prior to deletion.

  • Filters the cache directory to include only file objects.
  • Replaces a string split with a more direct substitute to compute relative paths.


await _repo.open();
final cachedObjects = await _repo.getAllObjects();
final dbFiles = cachedObjects.map((e) => e.relativePath).toSet();

final orphanedFiles = allFiles.where((file) {
final relativePath = file.path.split('$key/').last;
final relativePath = file.path.replaceFirst('${cacheDir.path}/', '');
Copy link
Preview

Copilot AI Jun 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a dedicated path manipulation function (e.g., path.relative from the path package) to compute relative paths, which can offer better cross-platform reliability than manual string replacement.

Suggested change
final relativePath = file.path.replaceFirst('${cacheDir.path}/', '');
final relativePath = path.relative(file.path, from: cacheDir.path);

Copilot uses AI. Check for mistakes.

@tommyxchow tommyxchow closed this Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant