Skip to content

downloadArtifact creates a directory in /tmp but does not remove it #355

@rde2

Description

@rde2

downloadArtifact calls validateArtifact to check the sha256 sums of a cached or newly downloaded file. It uses the download method internally to fetch the SHASUMS256 file and that also calls validateArtifact.

validateArtifact when called for SHASUMS256 starts by creating a new electron-download-xxxxxx directory in /tmp but then takes no further action:

return await withTempDirectoryIn(artifactDetails.tempDirectory, async (tempFolder) => {
    // Don't try to verify the hash of the hash file itself
    // and for older versions that don't have a SHASUMS256.txt
    if (!artifactDetails.artifactName.startsWith('SHASUMS256') &&

As a consequence the newly created directory is not removed.

Additionally the tempDirectory setting in artifactDetails is not used for this directory:

            shasumPath = await _downloadArtifact({
                isGeneric: true,
                version: artifactDetails.version,
                artifactName: 'SHASUMS256.txt',
                downloadOptions: artifactDetails.downloadOptions,
                cacheRoot: artifactDetails.cacheRoot,
                downloader: artifactDetails.downloader,
                mirrorOptions: artifactDetails.mirrorOptions,
                // Never use the cache for loading checksums, load
                // them fresh every time
                cacheMode: ElectronDownloadCacheMode.Bypass,
            });

The argument this download call should copy tempDirectory from artifactDetails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions