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

Download target changes after editing metadata #3248

Open
2 tasks
pgwillia opened this issue Sep 26, 2023 · 1 comment
Open
2 tasks

Download target changes after editing metadata #3248

pgwillia opened this issue Sep 26, 2023 · 1 comment
Assignees

Comments

@pgwillia
Copy link
Member

Describe the bug

image

It links to https://era.library.ualberta.ca/items/b0368001-8f63-4786-b994-1cf88fcfc826/download/c2fc73ae-c3f3-4b9b-8113-4130ee04d290 which is not a thing, hence the 404.

The item looks fine https://era.library.ualberta.ca/items/b0368001-8f63-4786-b994-1cf88fcfc826
image

And the download is fine too https://era.library.ualberta.ca/items/b0368001-8f63-4786-b994-1cf88fcfc826/download/921733ec-d539-40b5-a564-835260a82ea2

So what seems to be happening is that when any edit is made to an item, the files are given new identifiers, invalidating any existing links, like the one in Google Scholar.

To Reproduce
Steps to reproduce the behavior:

  1. Go to an item (any item)
  2. View the files in a separate tab
  3. Make an edit (doesn't seem to matter where the edit is made)
  4. Finish the wizard and click save
  5. Refresh the files being viewed in a separate tab. You'll notice that the target URL for downloads has a new identifier.

Expected behavior

  • If the files aren't substantially changed, the download URL will persist between saves to the item.
  • Is it possible to restore old identifiers so that Google Scholar links work again?

Additional context
Some oddity I could investigate is the metadata about the item we're displaying for google scholar.
image

https://search.google.com/search-console/index?resource_id=https://era.library.ualberta.ca/&utm_source=wnc_20237597&utm_medium=gamma&utm_campaign=wnc_20237597&utm_content=msg_110624660&hl=en-CA has been reporting broken links
image

@pgwillia
Copy link
Member Author

pgwillia commented Sep 26, 2023

I think the bug comes from line 159 where we assign a random fileset_uuid

# reset files if the files have changed in Fedora outside of the draft process
# NOTE: destroy the attachment record, DON'T use #purge, which will wipe the underlying blob shared with the
# published item's shim
files.each(&:destroy) if item.files.present?
# add an association between the same underlying blobs the Item uses and the Draft
item.files_attachments.each do |attachment|
ActiveStorage::Attachment.create(record: self,
blob: attachment.blob,
name: :files,
fileset_uuid: UUIDTools::UUID.random_create)
end

But I think that demonstrates that we could restore the old uuid from Google Scholar.

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

No branches or pull requests

1 participant