Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
compendium-v2
Commits
87c8380f
Commit
87c8380f
authored
7 months ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Update parsing of URLs in python to be more strict about what constitutes a valid URL
parent
16fa5be3
No related branches found
No related tags found
1 merge request
!134
Refactor
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compendium_v2/publishers/helpers.py
+3
-3
3 additions, 3 deletions
compendium_v2/publishers/helpers.py
with
3 additions
and
3 deletions
compendium_v2/publishers/helpers.py
+
3
−
3
View file @
87c8380f
import
re
from
urllib.parse
import
urlparse
from
validators.url
import
url
as
url_
parse
from
typing
import
List
from
sqlalchemy
import
select
...
...
@@ -45,9 +45,9 @@ def extract_urls(text: str) -> List[str]:
def
valid_url
(
url
:
str
)
->
bool
:
try
:
parsed
=
urlparse
(
url
)
parsed
=
url
_
parse
(
url
)
valid
=
bool
(
parsed
)
except
ValueError
:
except
Exception
:
valid
=
False
return
valid
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment