Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MJU-POPS
ckanext-dgu
Commits
676c6099
Commit
676c6099
authored
Mar 09, 2022
by
Marko Kuder
Browse files
remove_revisions: ignore protocol or domain changes on uploaded resources
parent
300044d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
ckanext/dgu/commands/remove_revisions.py
View file @
676c6099
...
...
@@ -38,7 +38,15 @@ class RemoveRevisions(CkanCommand):
def
are_equal
(
self
,
old_revision
,
new_revision
):
equal
=
True
for
attr
in
self
.
attributes
:
if
getattr
(
old_revision
,
attr
)
!=
getattr
(
new_revision
,
attr
):
if
attr
==
'url'
and
getattr
(
old_revision
,
'url_type'
)
==
'upload'
and
getattr
(
new_revision
,
'url_type'
)
==
'upload'
:
#compare without protocol prefix and domain, because on uploaded file url generation,
#some plugins might change http into https or localhost might be stored instead of site url
old_url
=
getattr
(
old_revision
,
attr
).
split
(
'//'
,
1
)[
-
1
].
split
(
'/'
,
1
)[
-
1
]
new_url
=
getattr
(
new_revision
,
attr
).
split
(
'//'
,
1
)[
-
1
].
split
(
'/'
,
1
)[
-
1
]
if
old_url
!=
new_url
:
equal
=
False
break
elif
getattr
(
old_revision
,
attr
)
!=
getattr
(
new_revision
,
attr
):
equal
=
False
break
return
equal
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment