Skip to content

[WEB-4013]chore: correct live url#7014

Merged
sriramveeraghanta merged 1 commit intopreviewfrom
chore-correct-live-urls
May 5, 2025
Merged

[WEB-4013]chore: correct live url#7014
sriramveeraghanta merged 1 commit intopreviewfrom
chore-correct-live-urls

Conversation

@pablohashescobar
Copy link
Member

@pablohashescobar pablohashescobar commented May 5, 2025

Description

chore: correct live url

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Test Scenarios

  • duplicate pages

References

WEB-4013

Summary by CodeRabbit

  • New Features

    • Introduced automatic URL path normalization to prevent issues caused by multiple consecutive slashes in URLs.
  • Bug Fixes

    • Improved handling of URLs to ensure consistent formatting when sending requests, reducing the risk of malformed URLs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 5, 2025

Walkthrough

The changes update the way URLs are constructed and normalized in the background task for copying S3 objects. The code in copy_s3_object.py now directly uses the raw settings.LIVE_URL string, appending the required path and normalizing it with a new utility function, normalize_url_path. The utility function is added in utils/url.py to collapse multiple consecutive slashes in the path component of a URL. Imports are adjusted accordingly, and previous parsing logic using get_url_components and urljoin is removed.

Changes

File(s) Change Summary
apiserver/plane/bgtasks/copy_s3_object.py Replaces get_url_components and urljoin usage with direct string handling and normalize_url_path for URL construction. Removes early return based on parsing, adjusts imports.
apiserver/plane/utils/url.py Adds normalize_url_path function to normalize multiple slashes in URL paths. Updates imports to include urlunparse and re.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant copy_s3_object.py
    participant utils/url.py

    Caller->>copy_s3_object.py: Initiate S3 object copy
    copy_s3_object.py->>copy_s3_object.py: Get settings.LIVE_URL
    copy_s3_object.py->>utils/url.py: normalize_url_path(live_url + "/convert-document/")
    utils/url.py-->>copy_s3_object.py: Return normalized URL
    copy_s3_object.py->>copy_s3_object.py: Send POST request to normalized URL
    copy_s3_object.py-->>Caller: Return response/result
Loading

Possibly related PRs

Suggested labels

🐛bug

Suggested reviewers

  • dheeru0198
  • sriramveeraghanta

Poem

A hop and a skip, through code we go,
URLs untangled, slashes in tow.
No more confusion, no double-back pain,
Paths now normalized, clear as the plain.
With every request, our journey is neat—
Hopping ahead, making code sweet! 🐇

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented May 5, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

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 (2)
apiserver/plane/utils/url.py (2)

60-60: Line exceeds character limit.

This docstring line exceeds the 88-character limit according to the linter.

-    Normalize the path component of a URL by replacing multiple consecutive slashes with a single slash.
+    Normalize the path component of a URL by replacing multiple consecutive slashes with a 
+    single slash.
🧰 Tools
🪛 Ruff (0.8.2)

60-60: Line too long (104 > 88)

(E501)


62-62: Line exceeds character limit.

This docstring line exceeds the 88-character limit according to the linter.

-    This function preserves the protocol, domain, query parameters, and fragments of the URL,
+    This function preserves the protocol, domain, query parameters, and fragments of the URL,
+    only modifying the path portion to ensure there are no duplicate slashes.
-    only modifying the path portion to ensure there are no duplicate slashes.
🧰 Tools
🪛 Ruff (0.8.2)

62-62: Line too long (93 > 88)

(E501)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42e2b78 and c14fea9.

📒 Files selected for processing (2)
  • apiserver/plane/bgtasks/copy_s3_object.py (3 hunks)
  • apiserver/plane/utils/url.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apiserver/plane/bgtasks/copy_s3_object.py (1)
apiserver/plane/utils/url.py (1)
  • normalize_url_path (58-79)
🪛 Ruff (0.8.2)
apiserver/plane/utils/url.py

60-60: Line too long (104 > 88)

(E501)


62-62: Line too long (93 > 88)

(E501)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (4)
apiserver/plane/utils/url.py (1)

58-79: Well-designed URL normalization function.

The normalize_url_path function elegantly handles normalizing URL paths by collapsing multiple consecutive slashes. Using urlparse and urlunparse ensures other URL components remain untouched.

🧰 Tools
🪛 Ruff (0.8.2)

60-60: Line too long (104 > 88)

(E501)


62-62: Line too long (93 > 88)

(E501)

apiserver/plane/bgtasks/copy_s3_object.py (3)

15-15: Good import change.

Appropriately imported the new normalize_url_path function to replace the previous URL joining mechanism.


72-77: Simplified URL handling logic.

The code now uses a more straightforward approach for handling the live URL. The normalize_url_path function ensures that any potential double slashes from concatenation are properly normalized.


76-76:

Details

✅ Verification successful

Verify URL construction consistency.

Make sure this URL construction behaves consistently with the previous implementation, especially for the test scenario mentioned in the PR objectives (checking for duplicate pages).


🏁 Script executed:

#!/bin/bash
# Check sample URLs to ensure normalization works as expected

# Test with different potential LIVE_URL formats
echo "Testing URL normalization with different URL formats:"
echo "-------------------------------------------------"

# Test with trailing slash
python3 -c "from plane.utils.url import normalize_url_path; print(normalize_url_path('https://example.com/' + '/convert-document/'))"

# Test without trailing slash
python3 -c "from plane.utils.url import normalize_url_path; print(normalize_url_path('https://example.com' + '/convert-document/'))"

# Test with multiple slashes
python3 -c "from plane.utils.url import normalize_url_path; print(normalize_url_path('https://example.com///' + '///convert-document/'))"

Length of output: 1027


🏁 Script executed:

#!/bin/bash
# Locate and display normalize_url_path implementation
echo "Finding normalize_url_path definition..."
RG_OUT=$(rg "def normalize_url_path" -n)
echo "$RG_OUT"

FILE=$(echo "$RG_OUT" | head -n1 | cut -d: -f1)
LINE=$(echo "$RG_OUT" | head -n1 | cut -d: -f2)

echo -e "\nShowing implementation in $FILE (lines $LINE$(($LINE+30))):"
sed -n "${LINE},$((LINE+30))p" "$FILE"

Length of output: 1653


🏁 Script executed:

#!/bin/bash
# Display context around the URL construction in copy_s3_object.py
echo "Showing lines 1–120 of apiserver/plane/bgtasks/copy_s3_object.py for context:"
sed -n '1,120p' apiserver/plane/bgtasks/copy_s3_object.py

# Locate live_url assignment
echo -e "\nSearching for live_url definition in the file:"
rg -n "live_url" -n apiserver/plane/bgtasks/copy_s3_object.py

Length of output: 4912


URL construction is consistent with previous behavior.

The normalize_url_path function collapses any duplicate slashes in the path segment, so whether settings.LIVE_URL ends with a slash or not (or even contains multiple slashes), the resulting URL will always be https://…/convert-document/. No changes are needed here.

@sriramveeraghanta sriramveeraghanta merged commit 0a01e0e into preview May 5, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-correct-live-urls branch May 5, 2025 19:51
al-jaber-nishad pushed a commit to Xinotrix-Home/task-and-meeting-management that referenced this pull request May 27, 2025
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
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.

2 participants