Skip to content

More resilient image names #82

Closed
Closed
@hatton

Description

@hatton

Currently, we extract an image name from the S3 URL that Notion uses. This name "matters" if you're doing image localization.

My concern is, what if Notion changes their URL scheme in a way that either a) requires a new regex to extract it (this has happened already once) or b) changes the id entirely?

Instead, we should use the id of the block, which is likely to be at least as stable, if not more-so, and doesn't require a regext to extract. here's a typical block with unnecessary stuff removed:

{
    "object": "block",
    "id": "690583ea-a11a-479a-b66d-b566eb1a52aa",   <--- we should use this for the image name

    "type": "image",
    "image": {
      "type": "file",
      "file": {
        "url": "https://s3.us-west-2.amazonaws.com/secure.notion-static.com/7c53cd0c-f6e6-43be-b1d0-e39124615294/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230926%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230926T154205Z&X-Amz-Expires=3600&X-Amz-Signature=82c0a4710cd112e0b3ff1b1fc60562747ad9b541891141ee3be0f97ac12f67bf&X-Amz-SignedHeaders=host&x-id=GetObject",
        "expiry_time": "2023-09-26T16:42:05.665Z"
      }
    }
  },

This is an easy fix, however it would break existing users, so we need a way to opt in or opt out of this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions