Skip to content

Commit

Permalink
CONSOLE-4404: set the global customLogo url even for customLogoFiles …
Browse files Browse the repository at this point in the history
…argument, using the static images when to customLogos are configured
  • Loading branch information
Mylanos committed Feb 17, 2025
1 parent 2c1a2a7 commit d88af9e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions frontend/public/components/masthead.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { MastheadToolbar } from './masthead-toolbar';
import { useCustomLogoURL, getBrandingDetails } from './utils/branding';

export const Masthead = React.memo(({ isMastheadStacked, isNavOpen, onNavToggle }) => {
const { productName, logoImg } = getBrandingDetails();
const { productName, staticLogo } = getBrandingDetails();
const navigate = useNavigate();
const defaultRoute = '/';
const logoUrl = useCustomLogoURL() || logoImg;
const logoUrl = useCustomLogoURL();
const logoProps = {
href: defaultRoute,
// use onClick to prevent browser reload
Expand Down Expand Up @@ -48,7 +48,7 @@ export const Masthead = React.memo(({ isMastheadStacked, isNavOpen, onNavToggle
{window.SERVER_FLAGS.customLogoURL ? (
<Brand src={logoUrl} alt={productName} />
) : (
<ReactSVG src={logoUrl} aria-hidden className="pf-v6-c-brand" />
<ReactSVG src={staticLogo} aria-hidden className="pf-v6-c-brand" />
)}
</MastheadLogo>
</MastheadBrand>
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/components/utils/branding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useCustomLogoURL = (type: CUSTOM_LOGO = MASTHEAD_TYPE): string => {
return THEME_LIGHT;
},
);
const fetchURL = `${window.SERVER_FLAGS.basePath}custom-logo?type=${type}&theme=${reqTheme}-theme`;
const fetchURL = `${window.SERVER_FLAGS.customLogoURL}?type=${type}&theme=${reqTheme}-theme`;
const response = await fetch(fetchURL);
if (!response.ok) {
throw new Error(`Failed to fetch ${fetchURL}: ${response.statusText}`);
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ func (s *Server) indexHandler(w http.ResponseWriter, r *http.Request) {

s.CSRFVerifier.SetCSRFCookie(s.BaseURL.Path, w)

if s.CustomLogoFile != "" {
if s.CustomLogoFile != "" || s.CustomLogoFiles != "" {
jsg.CustomLogoURL = proxy.SingleJoiningSlash(s.BaseURL.Path, customLogoEndpoint)
}

Expand Down

0 comments on commit d88af9e

Please sign in to comment.