elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

Elm make generates broken build if repo name contains dots #190

Open Leden opened 6 years ago

Leden commented 6 years ago

For example, "repository": "https://github.com/leden/lesnov.me.git" would be a completely valid repo name for Github, but as Elm make uses this piece to generate function names without sanitizing it first, it seems, the following happens:

// ...
var Elm = {};
Elm['Main'] = Elm['Main'] || {};
if (typeof _leden$lesnov.me$Main$main !== 'undefined') {
    _leden$lesnov.me$Main$main(Elm['Main'], 'Main', undefined);
}
// ...

See how the dot sneaked into the expression and ruined it?

When trying to run it, the following error happens:

Uncaught ReferenceError: runElmProgram is not defined
    at Main.elm:10
(anonymous) @ Main.elm:10

Should do some basic sanitization on such parameters, I think, and either fail loudly and ask the user to rename the repo, or escape dots and other possible trash silently. What do you think?

UPD: Some details on my report to comply with the checklist: My OS is Ubuntu Xenial 16.04.4 The browser is Chromium 64.0.3282.167 (Official Build) Built on Ubuntu, running on Ubuntu 16.04 (64-bit)

$ elm --version
0.18.0
process-bot commented 6 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.