Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOWNLOADS cache ignores the destination file, causing issue if mulitple download operations use a same download url #2

@Fallen-Breath

Description

@Fallen-Breath

private val DOWNLOADS = ConcurrentHashMap<URI, CompletableFuture<Unit>>()
fun download(url: URI, file: Path, listener: ((DownloadProgress) -> Unit)? = null) = DOWNLOADS.computeIfAbsent(url) {
startDownload(it, file, listener)
}

Issue at: DOWNLOADS.computeIfAbsent(url) ignores the file parameter

To reproduce

  1. Define a branch container both mc 1.20.3 and mc 1.20.4, using mojang mapping
  2. Run the monument

Expected behavior

Both mc 1.20.3 and mc 1.20.4 have their mojang mapping.txt downloaded successfully

Actual behavior

Only the first download attempts to the mapping.txt will succeed

Reason: mc1.20.3 and mc1.20.4 use the same mapping.txt, causing the issue that the later download attempt will be skipped (due to the computeIfAbsent) call

More information on the same server_mappings and client_mappings:

Example fix

private val DOWNLOADS = ConcurrentHashMap<Pair<URI, Path>, CompletableFuture<Unit>>()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions