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

Create asterisk.png without digest after precompile #7322

Closed

Conversation

SuperTux88
Copy link
Member

Fixes #7317

@SuperTux88 SuperTux88 added this to the 0.6.4.0 milestone Feb 11, 2017
@jhass
Copy link
Member

jhass commented Feb 12, 2017

Shouldn't we rather fix linking to a non-digest version?

@svbergerem
Copy link
Member

Like #7317 mentions this is linked as the OpenGraph image:

<meta property="og:image" content="/assets/branding/logos/asterisk.png" />

Are the old digest versions still available after creating a few new ones? We only look up the image once in our own implementation.

@jhass
Copy link
Member

jhass commented Feb 12, 2017

Yes, they're kept until you run rake assets:clean.

@svbergerem
Copy link
Member

@jhass
Copy link
Member

jhass commented Feb 12, 2017

Yeah, I'm aware, I'm just not too much of fan of side-stepping the cache bursting mechanism here. Perhaps we can rather define some routes with temporary redirects to the digest version?

logger = ::Logging::Logger["assets:non_digest_assets"]

non_digest_assets = Diaspora::Application.config.assets.non_digest_assets
manifest_path = Dir.glob(File.join(Rails.root, "public/assets/manifest-*.json")).first
Copy link
Member

Choose a reason for hiding this comment

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

This feels rather fragile, are we sure there's never more than one manifest?

Copy link
Member Author

Choose a reason for hiding this comment

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

I only have one file, and it gets updated when I do a precompile. If somebody has two files, it's probably a problem anyway, because sprockets also simply takes the first file: https://github.com/rails/sprockets/blob/v2.12.4/lib/sprockets/manifest.rb#L47-L55

@SuperTux88
Copy link
Member Author

The asterisk.png didn't change since two year, so it still is the same digest version. But every cached opengraph-result now links to the non-digest version.

I copied it once by hand to create the non-digest version, but that doesn't help other pods (and also it isn't there anymore, so I deleted it once by accident, probably when updating to 0.6, because I deleted the whole assets folder to have a clean start).

There is also a gem doing redirects from the non-digest versions to the latest digest version, but then every time somebody loads it, it needs two requests.

@SuperTux88 SuperTux88 requested a review from denschub March 3, 2017 02:45
Copy link
Member

@denschub denschub left a comment

Choose a reason for hiding this comment

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

Given the fact that this image is referenced externally and the digest-version could disappear, I am fine with using the non-digest version here!

@SuperTux88 SuperTux88 closed this in 8e42611 Mar 4, 2017
@SuperTux88 SuperTux88 deleted the create-non-digest-assets branch March 4, 2017 23:03
@svbergerem
Copy link
Member

Thank you :)

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.

None yet

4 participants