Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
api
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
Service Desk
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
cubicweb
cubes
api
Commits
0e97ee793c1e
Commit
0e97ee793c1e
authored
2 years ago
by
Frank Bessou
Browse files
Options
Downloads
Patches
Plain Diff
refactor: allow api-path-prefix to start/end by a '/'
parent
65d6f4ed0cbf
No related branches found
No related tags found
2 merge requests
!34
feat: remove 'api-server-name' configuration
,
!30
chore: avoid request pre-released version of black
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cubicweb_api/util.py
+3
-8
3 additions, 8 deletions
cubicweb_api/util.py
with
3 additions
and
8 deletions
cubicweb_api/util.py
+
3
−
8
View file @
0e97ee79
...
@@ -96,6 +96,6 @@
...
@@ -96,6 +96,6 @@
repo
=
get_cw_repo
(
config
)
repo
=
get_cw_repo
(
config
)
path_prefix
:
str
=
(
path_prefix
:
str
=
(
repo
.
get_option_value
(
"
api-path-prefix
"
)
or
API_PATH_DEFAULT_PREFIX
repo
.
get_option_value
(
"
api-path-prefix
"
)
or
API_PATH_DEFAULT_PREFIX
)
)
.
strip
(
"
/
"
)
match
=
re
.
match
(
"
^
/
[a-zA-Z0-9-_@.&+!*(),/]{1,29}$
"
,
path_prefix
)
match
=
re
.
match
(
"
^[a-zA-Z0-9-_@.&+!*(),/]{1,29}$
"
,
path_prefix
)
if
match
:
if
match
:
...
@@ -101,5 +101,5 @@
...
@@ -101,5 +101,5 @@
if
match
:
if
match
:
return
f
"
{
path_prefix
.
rstrip
(
'
/
'
)
}
/v1
"
return
f
"
{
path_prefix
}
/v1
"
else
:
else
:
if
len
(
path_prefix
)
>
30
:
if
len
(
path_prefix
)
>
30
:
raise
ConfigurationError
(
raise
ConfigurationError
(
...
@@ -107,11 +107,6 @@
...
@@ -107,11 +107,6 @@
"
Max size allowed is 30 characters.
"
"
Max size allowed is 30 characters.
"
f
"
Current size is
{
len
(
path_prefix
)
}
.
"
f
"
Current size is
{
len
(
path_prefix
)
}
.
"
)
)
if
not
path_prefix
.
startswith
(
"
/
"
):
raise
ConfigurationError
(
f
"
api-path-prefix
'
{
path_prefix
}
'
does not start with
'
/
'
.
"
"
Prefix should start with
'
/
'
to be validated by openapi
"
)
raise
ConfigurationError
(
raise
ConfigurationError
(
f
"
api-path-prefix
'
{
path_prefix
}
'
contains invalid characters.
"
f
"
api-path-prefix
'
{
path_prefix
}
'
contains invalid characters.
"
...
...
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