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

Bug fix/favicon referrerpolicy 2895 #4166

Merged
merged 3 commits into from
Feb 21, 2025

Conversation

devanyk2
Copy link
Contributor

@devanyk2 devanyk2 commented Feb 18, 2025

fixes 2895

test help: I have a test for the code modification but the code requires the environment to be in production mode, and I am having trouble getting that working in the test.

@johrstrom
Copy link
Contributor

test help: I have a test for the code modification but the code requires the environment to be in production mode, and I am having trouble getting that working in the test.

It looks like you've uncovered a bit of technical debt. The real solution I think is to change the code to not toggle off of the environment, but instead to toggle off of whether or not @user_configuration.public_url.join('favicon.ico') is legitimate or not. Without looking at that object I can't really say if it'll be easy to make that determination or not.

@devanyk2
Copy link
Contributor Author

It looks like you've uncovered a bit of technical debt. The real solution I think is to change the code to not toggle off of the environment, but instead to toggle off of whether or not @user_configuration.public_url.join('favicon.ico') is legitimate or not. Without looking at that object I can't really say if it'll be easy to make that determination or not.

Gotcha, I'll look into making that change.

@devanyk2
Copy link
Contributor Author

I don't think there is a way to verify if the value of public_uri is legitimate or not as the default value points to the default public asset location, and any user-provided value should be assumed to be legitimate.

Given that the default URI for the favicon is valid, does the favicon location need to be conditional?

 def favicon
      favicon_link_tag('favicon.ico', href: @user_configuration.public_url.join('favicon.ico'), skip_pipeline: true,  referrerpolicy: 'origin')
  end

@johrstrom
Copy link
Contributor

Given that the default URI for the favicon is valid, does the favicon location need to be conditional?

Doesn't sound like it.

@devanyk2 devanyk2 force-pushed the bug-fix/favicon-referrerpolicy-2895 branch from 0f7bd36 to 70573ab Compare February 18, 2025 22:28
@johrstrom
Copy link
Contributor

Ummm the default /public/favicon.ico doesn't seem to work in the test environment.

@devanyk2
Copy link
Contributor Author

Apologies, I did not realize that the bin/rake test command did not run the system tests.
I've reverted the changes to the favicon function and instead modified the test cases to mock the Rails.env.production? function.

@devanyk2
Copy link
Contributor Author

I'm not sure what caused these test failures, and I can't replicate them. Could they be transient?

Failure:
BatchConnectWidgetsTest#test_path_selector_handles_no_provided_file_pattern [test/system/batch_connect_widgets_test.rb:187]:
Expected false to be truthy.

Error:
ProjectManagerTest#test_submitting_a_script_with_auto_attributes_that_succeeds:
Errno::ENOTEMPTY: Directory not empty @ dir_s_rmdir - /tmp/d[202](https://github.com/OSC/ondemand/actions/runs/13420049992/job/37498656313?pr=4166#step:12:203)30327-15151-c5ftpl/projects
    test/system/project_manager_test.rb:379:in `block in <class:ProjectManagerTest>'

@johrstrom
Copy link
Contributor

I'm not sure what caused these test failures, and I can't replicate them. Could they be transient?

Yea it's #4105

@devanyk2
Copy link
Contributor Author

Awesome, thank you for all your help and time!

Is there anything else I need to do on my end?

@johrstrom johrstrom merged commit 419d230 into OSC:master Feb 21, 2025
22 checks passed
@johrstrom
Copy link
Contributor

Is there anything else I need to do on my end?

Nope! Thanks for the bug fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants