Skip to content

isStored → isNotHostedImage#2385

Merged
steven-tey merged 4 commits into
mainfrom
is-not-hosted-image
May 2, 2025
Merged

isStored → isNotHostedImage#2385
steven-tey merged 4 commits into
mainfrom
is-not-hosted-image

Conversation

@steven-tey
Copy link
Copy Markdown
Collaborator

No description provided.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dub ✅ Ready (Inspect) Visit Preview May 2, 2025 3:32am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR renames and refactors the image hosting check by replacing the isStored function with a new isNotHostedImage function throughout the codebase.

  • Introduced isNotHostedImage in storage.ts using a simplified URL check
  • Updated image handling in update, create, and bulk updating of links to use isNotHostedImage

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
apps/web/lib/storage.ts Added new function isNotHostedImage with a simplified hosted image check
apps/web/lib/api/links/update-link.ts Updated image proxy condition to use isNotHostedImage
apps/web/lib/api/links/create-link.ts Replaced isStored with isNotHostedImage in image handling logic
apps/web/lib/api/links/bulk-update-links.ts Replaced isStored with isNotHostedImage in image proxy evaluation
Comments suppressed due to low confidence (5)

apps/web/lib/api/links/create-link.ts:202

  • Ensure that the new check with isNotHostedImage properly differentiates between images that require upload and those that are already hosted.
proxy && image && isNotHostedImage(image) ? uploadedImageUrl : response.image,

apps/web/lib/storage.ts:157

  • The new isNotHostedImage function uses a simplified check (only verifying if the URL starts with 'https://') compared to the previous isStored logic. Please ensure this change covers all cases for hosted image URLs as intended.
export const isNotHostedImage = (imageString: string) => {

apps/web/lib/api/links/update-link.ts:96

  • Confirm that replacing '!isStored(image)' with 'isNotHostedImage(image)' correctly reflects the intended logic for proxy image handling in this update.
proxy && image && isNotHostedImage(image)

apps/web/lib/api/links/create-link.ts:63

  • Verify that using isNotHostedImage here yields the expected behavior, ensuring that only non-hosted images are processed for upload.
image: proxy && image && isNotHostedImage(image) ? null : image,

apps/web/lib/api/links/bulk-update-links.ts:53

  • Double-check that the updated image validation using isNotHostedImage consistently implements the intended proxy logic during bulk updates.
proxy && image && isNotHostedImage(image)

@steven-tey steven-tey merged commit d0e54b1 into main May 2, 2025
7 checks passed
@steven-tey steven-tey deleted the is-not-hosted-image branch May 2, 2025 04:30
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

Successfully merging this pull request may close these issues.

3 participants