Skip to content

chore: Merge 4.66.1 into master#6766

Merged
diegolmello merged 2 commits intomasterfrom
4.66.1
Nov 7, 2025
Merged

chore: Merge 4.66.1 into master#6766
diegolmello merged 2 commits intomasterfrom
4.66.1

Conversation

@diegolmello
Copy link
Member

@diegolmello diegolmello commented Nov 6, 2025

Proposed changes

Issue(s)

How to test or reproduce

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced image URL validation to ensure proper content type verification and display.
  • Chores

    • Version bumped to 4.66.1 across all platforms.

diegolmello and others added 2 commits November 6, 2025 11:03
* Fix image preview crashing on large pdfs

* Update snapshots

* Update app/containers/message/Urls.tsx

Co-authored-by: Noach Magedman <nmagedman@gmail.com>

---------

Co-authored-by: Noach Magedman <nmagedman@gmail.com>
@diegolmello diegolmello temporarily deployed to approve_e2e_testing November 6, 2025 14:05 — with GitHub Actions Inactive
@diegolmello diegolmello had a problem deploying to experimental_ios_build November 6, 2025 14:07 — with GitHub Actions Failure
@diegolmello diegolmello temporarily deployed to experimental_android_build November 6, 2025 14:07 — with GitHub Actions Inactive
@diegolmello diegolmello temporarily deployed to official_android_build November 6, 2025 14:07 — with GitHub Actions Inactive
@diegolmello diegolmello temporarily deployed to official_ios_build November 6, 2025 14:07 — with GitHub Actions Inactive
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Walkthrough

The PR updates the application version from 4.66.0 to 4.66.1 across Android and iOS build configurations, and package.json. It also refactors the image URL handling in Urls.tsx by introducing a memoized getImageUrl helper function via useCallback and adjusting state typing and effect dependencies.

Changes

Cohort / File(s) Change Summary
Version bump
android/app/build.gradle, ios/RocketChatRN.xcodeproj/project.pbxproj, ios/RocketChatRN/Info.plist, ios/ShareRocketChatRN/Info.plist, package.json
Update versionName, MARKETING_VERSION, CFBundleShortVersionString, and package version from 4.66.0 to 4.66.1.
Image URL refactoring
app/containers/message/Urls.tsx
Introduce memoized getImageUrl helper via useCallback; change imageUrl state typing to string | null and initialize to null; update effect dependency array to include API_Embed and getImageUrl reference; refactor internal logic to use _imageUrl for computed URL and verify image content type before setting state.

Sequence Diagram(s)

sequenceDiagram
    participant Effect as Effect Hook
    participant getImageUrl as getImageUrl (memoized)
    participant API as axios
    participant State as imageUrl State

    Effect->>getImageUrl: compute URL from url.image or url.url
    getImageUrl-->>Effect: return computed _imageUrl (string | null)
    
    alt _imageUrl exists
        Effect->>API: axios.head(_imageUrl)
        API-->>Effect: response with headers
        alt content-type is image
            Effect->>State: setImageUrl(_imageUrl)
        else content-type not image
            Effect->>State: setImageUrl(null)
        end
    else _imageUrl is null
        Effect->>State: setImageUrl(null)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Focus areas:
    • Verify the getImageUrl memoization logic correctly handles baseUrl and user credentials injection
    • Confirm effect dependency array changes and _imageUrl reference replacements are consistent throughout
    • Validate null-safety for the new string | null imageUrl state typing in rendering logic
    • Ensure version bumps are consistent across all configuration files

Possibly related PRs

  • #6763: Directly related—both PRs modify app/containers/message/Urls.tsx with identical memoized getImageUrl refactoring using useCallback and state typing changes.
  • #6759: Related—both PRs perform version bumps across android/app/build.gradle, iOS Info.plist/project.pbxproj, and package.json.
  • #6714: Related—both PRs update the same version-related fields in build configuration and package files.

Suggested reviewers

  • OtavioStasiak

Poem

🐰 A patch, a hop, a version's climb,
From 4.66.0 to .1 in time,
URLs memoized, no wasteful recount,
Swift image checks—the optimization's font,
A nimble release, both lean and bright! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: Merge 4.66.1 into master' accurately describes the primary purpose of the PR, which is a version bump and merge of release 4.66.1.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 4.66.1

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
app/containers/message/Urls.tsx (4)

128-135: Make URL building robust (handle existing query, leading slashes, optional user).
Current concatenation can produce double slashes and breaks when _imageUrl already contains query params. It also assumes user is always present.

Apply this diff to harden it:

-const getImageUrl = useCallback(() => {
-  const _imageUrl = url.image || url.url;
-
-  if (!_imageUrl) return null;
-  if (_imageUrl.startsWith('http')) return _imageUrl;
-  return `${baseUrl}/${_imageUrl}?rc_uid=${user.id}&rc_token=${user.token}`;
-}, [url.image, url.url, baseUrl, user.id, user.token]);
+const getImageUrl = useCallback(() => {
+  const raw = url.image || url.url;
+  if (!raw) return null;
+  // Absolute external URL: return as-is
+  if (/^https?:\/\//i.test(raw)) return raw;
+  try {
+    const base = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
+    const u = new URL(raw, base);
+    // Only append auth for same-origin URLs and when creds exist
+    if (user?.id && user?.token && u.origin === new URL(base).origin) {
+      u.searchParams.set('rc_uid', user.id);
+      u.searchParams.set('rc_token', user.token);
+    }
+    return u.toString();
+  } catch {
+    return null;
+  }
+}, [url.image, url.url, baseUrl, user?.id, user?.token]);

136-153: Avoid stale state; add cancellation and timeout to HEAD request.

  • If the URL isn’t an image (or API_Embed false), imageUrl isn’t cleared—can render a stale preview.
  • HEAD has no timeout/cancellation; can update state after unmount.

Apply this diff to improve resilience:

 useEffect(() => {
-  const verifyUrlIsImage = async () => {
-    try {
-      const _imageUrl = getImageUrl();
-      if (!_imageUrl || !API_Embed) return;
-
-      const response = await axios.head(_imageUrl);
-      const contentType = response.headers['content-type'];
-      if (contentType?.startsWith?.('image/')) {
-        setImageUrl(_imageUrl);
-      }
-    } catch {
-      // do nothing
-    }
-  };
-  verifyUrlIsImage();
-}, [url.image, url.url, API_Embed, getImageUrl]);
+  let cancelled = false;
+  const controller = new AbortController();
+  const verifyUrlIsImage = async () => {
+    try {
+      const _imageUrl = getImageUrl();
+      if (!_imageUrl || !API_Embed) {
+        if (!cancelled) setImageUrl(null);
+        return;
+      }
+      const response = await axios.head(_imageUrl, { signal: controller.signal, timeout: 5000 });
+      const contentType = response.headers['content-type'];
+      if (!cancelled && contentType?.startsWith?.('image/')) {
+        setImageUrl(_imageUrl);
+      } else if (!cancelled) {
+        setImageUrl(null);
+      }
+    } catch {
+      if (!cancelled) setImageUrl(null);
+    }
+  };
+  verifyUrlIsImage();
+  return () => {
+    cancelled = true;
+    controller.abort();
+  };
+}, [API_Embed, getImageUrl]);

153-153: Trim redundant deps.
url.image and url.url are already captured by getImageUrl; keep deps to [API_Embed, getImageUrl] to avoid duplicate runs.


71-82: Prevent state updates after unmount in UrlImage.
Guard Image.loadAsync with a cancellation flag; update state only if still mounted.

 useLayoutEffect(() => {
-  if (image && maxSize) {
-    Image.loadAsync(image, {
-      onError: () => {
-        setImageDimensions({ width: -1, height: -1 });
-      },
-      maxWidth: maxSize
-    }).then(image => {
-      setImageDimensions({ width: image.width, height: image.height });
-    });
-  }
-}, [image, maxSize]);
+  let cancelled = false;
+  if (image && maxSize) {
+    Image.loadAsync(image, {
+      onError: () => {
+        if (!cancelled) setImageDimensions({ width: -1, height: -1 });
+      },
+      maxWidth: maxSize
+    }).then(img => {
+      if (!cancelled) setImageDimensions({ width: img.width, height: img.height });
+    });
+  }
+  return () => {
+    cancelled = true;
+  };
+}, [image, maxSize]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c34e462 and f106f3c.

⛔ Files ignored due to path filters (1)
  • app/containers/message/__snapshots__/Message.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • android/app/build.gradle (1 hunks)
  • app/containers/message/Urls.tsx (2 hunks)
  • ios/RocketChatRN.xcodeproj/project.pbxproj (2 hunks)
  • ios/RocketChatRN/Info.plist (1 hunks)
  • ios/ShareRocketChatRN/Info.plist (1 hunks)
  • package.json (1 hunks)
🔇 Additional comments (7)
package.json (1)

3-3: Version bump looks good and consistent.
Version set to 4.66.1. Matches platform files in this PR.

ios/ShareRocketChatRN/Info.plist (1)

29-29: iOS Share extension marketing version updated correctly.
4.66.1 set on CFBundleShortVersionString.

ios/RocketChatRN/Info.plist (1)

31-31: iOS app marketing version updated correctly.
CFBundleShortVersionString set to 4.66.1.

ios/RocketChatRN.xcodeproj/project.pbxproj (1)

3037-3038: NotificationService MARKETING_VERSION aligned.
Both Debug/Release set to 4.66.1.

Also applies to: 3082-3083

app/containers/message/Urls.tsx (2)

1-1: Import addition is appropriate.
useCallback import matches new helper usage.


126-127: State typing improvement LGTM.
imageUrl as string | null is clearer and safer for rendering checks.

android/app/build.gradle (1)

93-93: Android versionName aligned.
versionName set to "4.66.1". Verify VERSIONCODE is appropriately bumped in CI/properties for Play uploads.

Run to confirm where VERSIONCODE is defined and its current value:

@diegolmello diegolmello temporarily deployed to upload_official_android November 6, 2025 14:34 — with GitHub Actions Inactive
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

Android Build Available

Rocket.Chat 4.66.1.107670

@diegolmello diegolmello temporarily deployed to upload_official_ios November 6, 2025 15:18 — with GitHub Actions Inactive
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

iOS Build Available

Rocket.Chat 4.66.1.107672

@diegolmello diegolmello had a problem deploying to upload_experimental_android November 6, 2025 15:39 — with GitHub Actions Failure
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

Android Build Available

Rocket.Chat Experimental 4.66.1.107674

Internal App Sharing: https://play.google.com/apps/test/RQVpXLytHNc/ahAO29uNSgoO0JnapX9m22FKRJ4OelQIG8QlNOoknm05q6npesoTqMyDn-ga_Cs1TeL6wKHJbjjtejPI21zVVl80fv

@diegolmello diegolmello merged commit a35becc into master Nov 7, 2025
43 of 50 checks passed
@diegolmello diegolmello deleted the 4.66.1 branch November 7, 2025 11:41
@diegolmello diegolmello had a problem deploying to experimental_android_build November 7, 2025 11:44 — with GitHub Actions Failure
@diegolmello diegolmello had a problem deploying to experimental_ios_build November 7, 2025 11:44 — with GitHub Actions Failure
@diegolmello diegolmello had a problem deploying to official_android_build November 7, 2025 11:44 — with GitHub Actions Failure
@coderabbitai coderabbitai bot mentioned this pull request Dec 1, 2025
10 tasks
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.

1 participant