Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Clean up temp repos when manage reset or finish-reset fails

Abierto
#29 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
api, backend

Línea de trabajo

Start with the reset and FinishReset handlers in the manage API, along with GetTempRepoPath, InitRepoAt, SoftDeleteRepo, CleanupRepoFolder and DeleteRepoIfExists, which the issue names. Check whether the repo exists before InitRepoAt runs in reset, and wrap the temp-directory work in FinishReset so a failure deletes _____temp_____/{code}__upload__{ts}. Done means both failure paths leave no temp directory behind and the 404 and error responses are unchanged.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Two manage operations leave a directory behind in _____temp_____ when they fail partway through.

1. POST /api/manage/repos/{code}/reset on a repo that doesn't exist

var tmpRepo = new DirectoryInfo(GetTempRepoPath(code, "reset"));
await InitRepoAt(tmpRepo, cancellationToken);            // creates _____temp_____/{code}__reset__{ts}
await SoftDeleteRepo(code, ResetSoftDeleteSuffix(...));  // throws DirectoryNotFoundException -> 404
tmpRepo.MoveTo(PrefixRepoFilePath(code));                // never reached

The caller gets a 404, but the freshly initialised temp repo is never cleaned up.

2. POST /api/manage/repos/{code}/finish-reset with a corrupt or invalid zip

FinishReset creates _____temp_____/{code}__upload__{ts} and then extracts into it. If ExtractToDirectory throws (bad zip, InvalidDataException, IO error, cancellation), the partially extracted directory stays behind. Only the "no .hg folder" path deletes it. The same is true for exceptions thrown later in the method, for example from CleanupRepoFolder or DeleteRepoIfExists.

Nothing cleans up _____temp_____, so these accumulate on the volume (a failed upload can be large).

Suggested fix: wrap both in try/catch (or finally with a success flag) that deletes the temp directory on failure. For reset, check that the repo exists before running InitRepoAt.

Note: this logic is a port of LexBox's HgService, which has the same behaviour today, so LexBox will keep this behaviour when it switches to /api/manage unless it's fixed here.

Lenguaje dominante
C#
Estrellas
0
Forks
1
Merge medio
1 d 20 h
PR fusionados (30 d)
2

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sillsdev/hgresume

Todos los issues de sillsdev/hgresume

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.