Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sources.ts #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Nipurn123
Copy link

Changes Made:

1.URL Decoding: Previously, the application used URL strings directly without decoding them, leading to invalid URL errors. In this update, URL decoding using decodeURIComponent() has been implemented before fetching content from each URL. This ensures that special characters in the URLs are properly decoded, preventing "Invalid URL" errors.

2.Error Handling Enhancement: Error handling has been improved by adding try...catch blocks around the code responsible for fetching and parsing content from each URL. This allows catching and logging any errors that occur during the process, preventing the application from crashing due to unhandled exceptions.

3.Filtered Source Check: After processing the sources, a check has been added to filter out any sources that might be null (e.g., if there was an error fetching or parsing content from a particular URL). This ensures that only valid sources are further processed, avoiding potential issues.

4.Text Slicing: After cleaning the text content of each source, a check has been added to ensure that the text is sliced to a maximum length of 1500 characters. This helps in limiting the size of the text and prevents excessively long text from being returned in the response.

Changes Made:

1.URL Decoding: Previously, the application used URL strings directly without decoding them, leading to invalid URL errors. In this update, URL decoding using decodeURIComponent() has been implemented before fetching content from each URL. This ensures that special characters in the URLs are properly decoded, preventing "Invalid URL" errors.

2.Error Handling Enhancement: Error handling has been improved by adding try...catch blocks around the code responsible for fetching and parsing content from each URL. This allows catching and logging any errors that occur during the process, preventing the application from crashing due to unhandled exceptions.

3.Filtered Source Check: After processing the sources, a check has been added to filter out any sources that might be null (e.g., if there was an error fetching or parsing content from a particular URL). This ensures that only valid sources are further processed, avoiding potential issues.

4.Text Slicing: After cleaning the text content of each source, a check has been added to ensure that the text is sliced to a maximum length of 1500 characters. This helps in limiting the size of the text and prevents excessively long text from being returned in the response.
Copy link

vercel bot commented Mar 8, 2024

@Nipurn123 is attempting to deploy a commit to the Personal Team on Vercel.

A member of the Team first needs to authorize it.

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