Skip to content

Conversation

rose-m
Copy link
Contributor

@rose-m rose-m commented May 17, 2021

Fixes the issue of images not showing in the MSI installer.

@rose-m rose-m self-assigned this May 17, 2021
Copy link
Collaborator

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense :)

Maybe, to avoid the filename check, we could just skip the interpolation for non-UTF-8 files? i.e.

      } else {
        const sourceText = await fs.readFile(sourceFile, 'utf8');
        if (!sourceText.contains('\ufffd')) { // This is valid UTF-8, i.e. a text file
          const interpolatedText = sourceText.replace(
            /\{\{(\w+)\}\}/g,
            (_match, identifier) => {
              if (!(identifier in interpolations)) {
                throw new Error(`Need ${identifier} for replacement in ${sourceFile}`);
              }
              return interpolations[identifier];
            });
          await fs.writeFile(targetFile, interpolatedText);
        } else {
          await fs.copyFile(sourceFile, targetFile);
        }
      }

@rose-m rose-m force-pushed the MONGOSH-763-fix-msi-installer branch from e207472 to 4a9dab4 Compare May 17, 2021 11:58
@rose-m rose-m merged commit 744317b into main May 17, 2021
@rose-m rose-m deleted the MONGOSH-763-fix-msi-installer branch May 17, 2021 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants