Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior when package name contains '.' (i.e. in the product name before the version part) #283

Open
RexTremendae opened this issue Mar 15, 2015 · 4 comments

Comments

@RexTremendae
Copy link

We have been trying out Squirrel on a project at our company, and we found an issue because we name all our packages like this: ....nupkg

What happens when we do this is that when the program gets installed the first time, it ends up under the folder . When we run it from there and the update code finds the latest version (which is the same as already installed) a new instance is installed under the folder ... This version will then update as it should in the future, but we will end up with two different installations of the same application (two different folders, and two entries in the "programs and features" list).

We found that the reason for this behavior is the following lines in the ReleaseEntry.cs:
public string PackageName {
get { return Filename.Substring(0, Filename.IndexOfAny(new[] { '-', '.' })); }
}

I'm not really sure WHY it looks like this. Is it a lazy way to find the version numbers in the end of the name string? Could it be an option to use regex to parse out the version number instead?

@anaisbetts
Copy link
Contributor

Someone submitted a patch to fix this but never finished it. In the meantime I'd just remove the dots.

@raybooysen
Copy link

Dupe of #530 .

@quasarea
Copy link

quasarea commented Jul 4, 2019

this property was already changed to

    static readonly Regex packageNameRegex = new Regex(@"^([\w-]+)-\d+\..+\.nupkg$");
    [IgnoreDataMember]
    public string PackageName {
        get {
            var match = packageNameRegex.Match(Filename);
            return match.Success ?
                match.Groups[1].Value :
                Filename.Substring(0, Filename.IndexOfAny(new[] { '-', '.' }));
        }
    }

but it is not enough to solve the issue when name contains a dot, adding . to capture group seems to solve this:

    static readonly Regex packageNameRegex = new Regex(@"^([\w-\.]+)-\d+\..+\.nupkg$");

@Thieum
Copy link
Contributor

Thieum commented Jul 4, 2019

@quasarea would you consider sending a PR with the fix and a failing / passing unit test with the case at hand?

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

No branches or pull requests

5 participants