Skip to content

anujchoudhary-17 : Fixed - Error loading local files on Windows machines #28 issue#44

Open
anujchoudhary-17 wants to merge 2 commits into
1Password:mainfrom
anujchoudhary-17:main
Open

anujchoudhary-17 : Fixed - Error loading local files on Windows machines #28 issue#44
anujchoudhary-17 wants to merge 2 commits into
1Password:mainfrom
anujchoudhary-17:main

Conversation

@anujchoudhary-17

@anujchoudhary-17 anujchoudhary-17 commented Jun 10, 2023

Copy link
Copy Markdown

Please review src\index.ts added a boolean function name validatingURLusingRegex to verify with regex which checks whether the start of the url string is either http or https.

Issue link : #28

image

@anujchoudhary-17 anujchoudhary-17 changed the title anujchoudhary-17 : Fixed - Error loading local files on Windows machines #28 issue anujchoudhary-17 : Fixed - Error loading local files on Windows machines https://github.com/1Password/docusaurus-extensions/issues/28 issue Jun 10, 2023
@anujchoudhary-17 anujchoudhary-17 changed the title anujchoudhary-17 : Fixed - Error loading local files on Windows machines https://github.com/1Password/docusaurus-extensions/issues/28 issue anujchoudhary-17 : Fixed - Error loading local files on Windows machines #28 issue Jun 10, 2023
};


const validatingURLusingRegex = (locationString : string): Boolean => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this is only checking if the protocol is valid, not the rest of the URL, I would recommend either:

  • Renaming the function to something like isHttpOrHttps(locationString: string): boolean
  • Validating the rest of the URL with something like the following (untested)
const validateUrl = (location: string): boolean => {
  try {
    const url = new URL(location);
    return url.protocol === "http:" || url.protocol === "https:";
  } catch {
    return false;
  }
};

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay, Thank you @mrjones2014 :) for the feedback. I am new to Open Source so just trying my best to contribute. I will update it and raise the PR again :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love to see new open source contributors ❤️

Please feel free to let me know if you need any help!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi @mrjones2014 ,
Updated the branch and implemented the second option you suggested. Please review it :)
Thank you

@jodyheavener jodyheavener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @anujchoudhary-17, thanks for opening this, and we're so excited for your contributions to 1Password's open source projects! Couple things I wanted to note:

  • All our repositories require commits to signed before we can merge to the main branch. I know from your other PR that you've just got set up with commit signing, so let me know if you run into any troubles.
  • For this to merge we need to maintain a consistent code format - while you can set up your IDE to do this for you automatically on save, you can also run yarn format:write from the root of this project to auto-format all your code.
  • Similarly, it appears there are a handful of linting errors that are failing CI. Please take a moment to review them (you can run yarn lint:scripts to check this out locally) and submit your changes.

Thanks again for taking the time to contribute. Please let me know if you need a hand with anything 🙂

@anujchoudhary-17

Copy link
Copy Markdown
Author

Hi @jodyheavener ,
The yarn format:write is running fine and getting the following result
image

but when I try to run yarn lint:scripts
I am getting this error.
image

Not sure how to solve it.

@jodyheavener

Copy link
Copy Markdown
Member

Hi @anujchoudhary-17 those are some interesting results you're seeing. I have not previously run this project on a Windows machine, but I don't think that should matter. Please ensure that you are using Node 16 and have run yarn install at the root of the project. Eventually you should start to see the same errors that are being reported in your PR's CI.

@anujchoudhary-17

Copy link
Copy Markdown
Author

@jodyheavener Yes I have checked all those things already it is exactly what you are expecting. Still getting the same issue :(

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