homebrewery icon indicating copy to clipboard operation
homebrewery copied to clipboard

Thumbnail URL being incorrectly added to Google Metadata

Open ShamelessHero502 opened this issue 2 years ago • 5 comments

Error: Forbidden

Error: Forbidden
    at Request.<anonymous> (https://homebrewery.naturalcrit.com/homebrew/bundle.js:75346:19)
    at Emitter.emit (https://homebrewery.naturalcrit.com/homebrew/bundle.js:1966:20)
    at xhr.onreadystatechange (https://homebrewery.naturalcrit.com/homebrew/bundle.js:75655:10)
{
  "status": 403,
  "method": "PUT",
  "url": "/api/update/AxN03P6n6_9t"
}

ShamelessHero502 avatar Sep 09 '22 20:09 ShamelessHero502

Error log says your url is way too long. Can you by chance share the URL you are trying to use for your thumbnail?

calculuschild avatar Sep 09 '22 21:09 calculuschild

https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/b700c630-9435-4853-b567-d025115b827b/degakzn-576504c0-f8f6-40f0-b130-3a19544a0e9e.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2I3MDBjNjMwLTk0MzUtNDg1My1iNTY3LWQwMjUxMTViODI3YlwvZGVnYWt6bi01NzY1MDRjMC1mOGY2LTQwZjAtYjEzMC0zYTE5NTQ0YTBlOWUucG5nIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.yPaYT4GYrakHIDBEXastMExHC4xVn4_kUFmgvd5J7sA

ShamelessHero502 avatar Sep 10 '22 00:09 ShamelessHero502

Yep, that giant link is the issue. Can you possibly put the image on a different image host Imgur to get a shorter link?

calculuschild avatar Sep 10 '22 00:09 calculuschild

This is a re-emergence of a previous issue we had with the thumbnails.

@G-Ambatte

After merging this I immediately found a critical error, so feel free to create a new PR here since we can't reopen PRs directly it seems.

The error is this: Google Drive has a 124-byte limit on any property added to a document. Long image urls will cause the saving step to fail, which is actually pretty common. We're going to need an alternative way to add this to the Google document.

errors: [
    {
      domain: 'global',
      reason: 'propertyLengthLimitExceeded',
      message: 'Properties and app properties are limited to 124 bytes in UTF-8 encoding, counting both the key and the value.'
    }
  ]

Originally posted by @calculuschild in https://github.com/naturalcrit/homebrewery/issues/1777#issuecomment-960377433

At the time, we did not have the ```metadata codefence on brews to hold larger metadata items. However, when we did finally re-enable thumbnails, we never actually moved the property to the metadata codefence. Hence we are still striking the 124-byte limit on Google Drive.

In any case, now that we have Stubs, the thumbnail is being stored there as well, and as a "social media" element doesn't need to actually be saved into the source of the brew. All we need to do is remove the metadata from being saved as a Google Drive Property.

@G-Ambatte seems like this might be up your alley as part of the work on thumbnails? Can we move the thumbnails from being stored as a Google Drive property into Stubs? @jeddai or @calculuschild can point the way to interact with the stubs if you are willing to work on this but need help.

  • [ ] Remove Thumbnail URL from Google Drive properties (both saving and loading).

calculuschild avatar Sep 12 '22 20:09 calculuschild

I'll probably need to have a chat with @jeddai about it; I think I've got a working branch now. Down side of the current iteration is that the thumbnail on any Google brews are reset.

G-Ambatte avatar Sep 24 '22 11:09 G-Ambatte