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

Community CSS <link> 404s on new records not in a community #2830

Open
phette23 opened this issue Sep 3, 2024 · 0 comments
Open

Community CSS <link> 404s on new records not in a community #2830

phette23 opened this issue Sep 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@phette23
Copy link

phette23 commented Sep 3, 2024

Package version (if known): v12.0.5

Describe the bug

On the deposit form, community theme CSS is loaded in a tag like <link rel="stylesheet" type="text/css" href="/communities//community-theme-.css"> whosehref URL 404s since it's missing components. This is apparent on the demo site if you login, go to upload, and view your browser's console.

Steps to Reproduce

  1. Login
  2. Create a new upload outside of any existing community /uploads/new

Expected behavior

No community theme CSS should be loaded since the record is not part of a community.

Screenshots (if applicable)

Screenshot 2024-09-03 at 16 25 58

Excerpt of the <head> of /uploads/new:

<title>New upload</title>
      <link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico"/>
          <link rel="apple-touch-icon" sizes="120x120" href="/static/apple-touch-icon-120.png"/>
          <link rel="apple-touch-icon" sizes="152x152" href="/static/apple-touch-icon-152.png"/>
          <link rel="apple-touch-icon" sizes="167x167" href="/static/apple-touch-icon-167.png"/>
          <link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon-180.png"/>
  
      <link rel="stylesheet" href="/static/dist/css/3526.b4b7482b3f9ce31d1a70.css" />
      <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
      <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
      <![endif]-->
  <link rel="stylesheet" type="text/css" href="/communities//community-theme-.css">

Additional context

I was unable to fix this by editing my local app-rdm and communities packages' templates. I suspect the issue is either in app-rdm's records/deposit.html or communities' base.html. The URL in the templates is like <link rel="stylesheet" type="text/css" href="/communities/{{community.slug}}/community-theme-{{ community.revision_id }}.css"> so it's clear that the slug and revision_id are missing. What's odd is both templates wrap the <link> in a condition, so it seems like it should not appear on a record with no communities. My only thought is maybe draft records are considered part of some pseudo-community which has an enabled theme (making the condition in deposit.html true) but no slug nor revision_id.

@phette23 phette23 added the bug Something isn't working label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant