[PR #75] [MERGED] Add key file date comparison before upload #79

Closed
opened 2026-02-28 01:17:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/therealpaulgg/ssh-sync/pull/75
Author: @therealpaulgg
Created: 1/14/2026
Status: Merged
Merged: 1/15/2026
Merged by: @therealpaulgg

Base: mainHead: claude/key-date-comparison-DsQxK


📝 Commits (1)

  • fdca4a1 Add date comparison warning for key uploads

📊 Changes

3 files changed (+72 additions, -5 deletions)

View changed files

📝 pkg/actions/upload.go (+38 -0)
📝 pkg/dto/main.go (+10 -5)
📝 pkg/utils/io.go (+24 -0)

📄 Description

Implement safety check to prevent accidentally overwriting newer server keys with older local versions during upload. When uploading keys, the client now:

  1. Fetches existing keys from the server with their timestamps
  2. Compares local file modification times with server timestamps
  3. Prompts the user if attempting to overwrite a newer server key
  4. Allows user to proceed or skip the file

This mirrors the existing conflict detection on the download side and addresses the warning in the README about upload overwriting without checks.

Changes:

  • Add UpdatedAt timestamp field to KeyDto (optional for backward compatibility)
  • Add PromptOverwriteNewerKey helper function in utils/io.go
  • Modify Upload action to decode server response and compare dates
  • Skip files when user chooses not to overwrite newer versions

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/therealpaulgg/ssh-sync/pull/75 **Author:** [@therealpaulgg](https://github.com/therealpaulgg) **Created:** 1/14/2026 **Status:** ✅ Merged **Merged:** 1/15/2026 **Merged by:** [@therealpaulgg](https://github.com/therealpaulgg) **Base:** `main` ← **Head:** `claude/key-date-comparison-DsQxK` --- ### 📝 Commits (1) - [`fdca4a1`](https://github.com/therealpaulgg/ssh-sync/commit/fdca4a1702d0c6f4ef646f25369860a8af2f0e3a) Add date comparison warning for key uploads ### 📊 Changes **3 files changed** (+72 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `pkg/actions/upload.go` (+38 -0) 📝 `pkg/dto/main.go` (+10 -5) 📝 `pkg/utils/io.go` (+24 -0) </details> ### 📄 Description Implement safety check to prevent accidentally overwriting newer server keys with older local versions during upload. When uploading keys, the client now: 1. Fetches existing keys from the server with their timestamps 2. Compares local file modification times with server timestamps 3. Prompts the user if attempting to overwrite a newer server key 4. Allows user to proceed or skip the file This mirrors the existing conflict detection on the download side and addresses the warning in the README about upload overwriting without checks. Changes: - Add UpdatedAt timestamp field to KeyDto (optional for backward compatibility) - Add PromptOverwriteNewerKey helper function in utils/io.go - Modify Upload action to decode server response and compare dates - Skip files when user chooses not to overwrite newer versions --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 01:17:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ssh-sync#79
No description provided.