배경
Task 4 (이슈 #4, 코어 v4.2 반영)에서 drive upload --resume 플래그가 도입되었으나, 현재는 업로드 URL 생성 요청의 request body에 resume: true만 전달하는 반쪽 구현 상태이다.
현재 동작
4개 upload 커맨드(drive upload, drive shared upload, drive group upload, drive shared-folder upload) 모두:
POST /.../files 요청 시 body에 resume: true 필드를 실어 서버에 resumable 업로드 세션을 요청
- 서버는 응답으로
uploadUrl과 offset을 반환 (offset > 0이면 중단된 업로드의 재개 지점)
- CLI는 응답의
offset을 무시하고 doUploadFromResponse → Client.UploadFile 경로를 통해 항상 byte 0부터 전체 파일을 PUT한다
따라서 사용자가 --resume을 지정해도 이전 업로드 중단 지점부터 재전송되지 않는다.
필요한 작업
internal/api/client.go에 UploadFileFromOffset(uploadURL, localPath string, offset int64) error 메서드 추가
f.Seek(offset, io.SeekStart)로 파일 포인터 이동
req.ContentLength = size - offset
offset > 0일 때 req.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", offset, size-1, size))
cmd/helpers.go의 doUploadFromResponse가 응답 JSON에서 offset 필드를 파싱하고 UploadFileFromOffset 호출
- 4개 upload RunE 공통 경로라 helper 한 곳 수정으로 4개 커맨드 전부 커버 가능
- 테스트
internal/api/client_test.go: 응답 {"uploadUrl":"...","offset":100} 돌려주는 httptest 서버로 Content-Range: bytes 100-... 헤더 검증
- 4개 upload 경로 각각에 대해 body에
resume:true 전달 + response offset 기반 PUT 검증 테이블 테스트
근거
- Pre-flight Findings (docs/plans/2026-04-15-issues-reflection.md):
resume body field와 offset 응답 필드 모두 공식 API 문서(developers.worksmobile.com/en/docs/drive-file-root-create, sharedrive-file-create)에 명시됨
- codex-code-review (2026-04-15): "
--resume은 upload URL 생성 요청에 resume=true만 추가함. 후속 업로드 경로는 여전히 doUploadFromResponse → Client.UploadFile로 고정돼 있어서 서버가 돌려주는 offset을 전혀 쓰지 않고 항상 byte 0부터 전체 파일을 PUT함" 지적
- docs/upload-spec-matrix.md: Response Model
DriveFileUploadUrlResponse(uploadUrl, offset) 명시
현 상태 대비 영향 범위
- 현 구현:
--resume은 "서버 resumable 업로드 세션 시작 요청" 용도만 수행
- 플래그 description/주석/문서는 이미 범위 명시를 반영 (커밋
3027aa3)
이 이슈가 해결되면:
cmd/drive.go --resume 플래그 description에서 "(실제 재전송은 미구현)" 문구 제거
docs/upload-spec-matrix.md drive upload 섹션에서 "offset 기반 Content-Range 재전송 로직은 아직 미구현" 문구 제거
internal/api/mail.go 근처 WHY 주석 단순화 가능
관련 이슈
배경
Task 4 (이슈 #4, 코어 v4.2 반영)에서
drive upload --resume플래그가 도입되었으나, 현재는 업로드 URL 생성 요청의 request body에resume: true만 전달하는 반쪽 구현 상태이다.현재 동작
4개 upload 커맨드(
drive upload,drive shared upload,drive group upload,drive shared-folder upload) 모두:POST /.../files요청 시 body에resume: true필드를 실어 서버에 resumable 업로드 세션을 요청uploadUrl과offset을 반환 (offset > 0이면 중단된 업로드의 재개 지점)offset을 무시하고doUploadFromResponse→Client.UploadFile경로를 통해 항상 byte 0부터 전체 파일을 PUT한다따라서 사용자가
--resume을 지정해도 이전 업로드 중단 지점부터 재전송되지 않는다.필요한 작업
internal/api/client.go에UploadFileFromOffset(uploadURL, localPath string, offset int64) error메서드 추가f.Seek(offset, io.SeekStart)로 파일 포인터 이동req.ContentLength = size - offsetoffset > 0일 때req.Header.Set("Content-Range", fmt.Sprintf("bytes %d-%d/%d", offset, size-1, size))cmd/helpers.go의doUploadFromResponse가 응답 JSON에서offset필드를 파싱하고UploadFileFromOffset호출internal/api/client_test.go: 응답{"uploadUrl":"...","offset":100}돌려주는 httptest 서버로Content-Range: bytes 100-...헤더 검증resume:true전달 + response offset 기반 PUT 검증 테이블 테스트근거
resumebody field와offset응답 필드 모두 공식 API 문서(developers.worksmobile.com/en/docs/drive-file-root-create,sharedrive-file-create)에 명시됨--resume은 upload URL 생성 요청에resume=true만 추가함. 후속 업로드 경로는 여전히doUploadFromResponse→Client.UploadFile로 고정돼 있어서 서버가 돌려주는offset을 전혀 쓰지 않고 항상 byte 0부터 전체 파일을 PUT함" 지적DriveFileUploadUrlResponse(uploadUrl, offset)명시현 상태 대비 영향 범위
--resume은 "서버 resumable 업로드 세션 시작 요청" 용도만 수행3027aa3)이 이슈가 해결되면:
cmd/drive.go--resume플래그 description에서 "(실제 재전송은 미구현)" 문구 제거docs/upload-spec-matrix.mddrive upload 섹션에서 "offset 기반 Content-Range 재전송 로직은 아직 미구현" 문구 제거internal/api/mail.go근처 WHY 주석 단순화 가능관련 이슈