Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

asp-append-version not working on Linux #2979

Closed
Daniel15 opened this issue Aug 16, 2015 · 4 comments
Closed

asp-append-version not working on Linux #2979

Daniel15 opened this issue Aug 16, 2015 · 4 comments
Assignees
Milestone

Comments

@Daniel15
Copy link
Contributor

In my _Layout.cshtml:

<link rel="stylesheet" href="~/cache/main.min.css" asp-append-version="true"/>

On my development machine (Windows 7, Visual Studio 2015, Kestrel), this correctly appends the version:

<link rel="stylesheet" href="/cache/main.min.css?v=GQLFOo4-np2RJQauQG_3iKMNbSjDM5osk_tVLhNAnhE" />

However, in my production environment (Mono 4.0.2, Kestrel), no version is appended:

<link rel="stylesheet" href="/cache/main.min.css" />

Tested on Mono 4.0.2 and ASP.NET 5 Beta 6.

I'm deploying the site by doing dnu publish into a temporary directory, then rsyncing that temporary directory to the remote server.

@Daniel15
Copy link
Contributor Author

The problematic section of code is this part in FileVersionProvider.cs:

            Uri uri;
            if (Uri.TryCreate(resolvedPath, UriKind.Absolute, out uri))
            {
                // Don't append version if the path is absolute.
                return path;
            }

Mono's implementation of Uri.TryCreate is resolving /foo.css to file:///foo.css, because technically /foo.css is an absolute path to a file on Linux. Thus, it's just returning path unmodified. 😭

I think it should either explicitly be checking IsFile on the Uri. I'll submit a patch.

Daniel15 added a commit to Daniel15/Website that referenced this issue Aug 16, 2015
. This works because the layout has a <base> tag in it.
@danroth27
Copy link
Member

@NTaylorMullen @ajaybhargavb

Yup, looks like something we would love to get a PR for. Thanks for finding the issue!

@danroth27 danroth27 added this to the 6.0.0-beta8 milestone Aug 18, 2015
@Daniel15
Copy link
Contributor Author

I already submitted pull request #2980 to fix this issue :)

Sent from my phone
On Aug 18, 2015 1:07 PM, "Daniel Roth" [email protected] wrote:

@NTaylorMullen https://github.com/NTaylorMullen @ajaybhargavb
https://github.com/ajaybhargavb

Yup, looks like something we would love to get a PR for. Thanks for
finding the issue!


Reply to this email directly or view it on GitHub
#2979 (comment).

@dougbu
Copy link
Member

dougbu commented Sep 1, 2015

a2e53e8

@dougbu dougbu closed this as completed Sep 1, 2015
@dougbu dougbu assigned dougbu and unassigned ajaybhargavb Sep 1, 2015
@dougbu dougbu added 3 - Done and removed 1 - Ready labels Sep 1, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants