Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
3e5f05e8
Commit
3e5f05e8
authored
Apr 10, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: implement is_strange_url and use it to prevent break correct URL, try check all locations
parent
0dbcdadb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
16 deletions
+29
-16
tools_eget
bin/tools_eget
+29
-16
No files found.
bin/tools_eget
View file @
3e5f05e8
...
@@ -204,6 +204,13 @@ is_url()
...
@@ -204,6 +204,13 @@ is_url()
echo
"
$1
"
|
grep
-q
"^[filehtps]*:/"
echo
"
$1
"
|
grep
-q
"^[filehtps]*:/"
}
}
is_strange_url
()
{
local
URL
=
"
$1
"
is_url
"
$URL
"
||
return
echo
"
$URL
"
|
grep
-q
"[?&]"
}
is_ipfs_hash
()
is_ipfs_hash
()
{
{
echo
"
$1
"
|
grep
-q
-E
"^Qm[[:alnum:]]{44}$"
echo
"
$1
"
|
grep
-q
-E
"^Qm[[:alnum:]]{44}$"
...
@@ -779,11 +786,13 @@ url_get_real_url()
...
@@ -779,11 +786,13 @@ url_get_real_url()
# don't check location if we have made form of the URL
# don't check location if we have made form of the URL
[
-n
"
$MADEURL
"
]
&&
[
"
$MADEURL
"
=
"
$URL
"
]
&&
echo
"
$URL
"
&&
return
[
-n
"
$MADEURL
"
]
&&
[
"
$MADEURL
"
=
"
$URL
"
]
&&
echo
"
$URL
"
&&
return
local
loc
=
"
$(
url_get_header
"
$URL
"
"Location"
|
tail
-n1
)
"
local
loc
if
is_url
"
$loc
"
;
then
for
loc
in
$(
url_get_header
"
$URL
"
"Location"
|
tac
)
;
do
echo
"
$loc
"
if
!
is_strange_url
"
$loc
"
;
then
return
echo
"
$loc
"
fi
return
fi
done
echo
"
$URL
"
echo
"
$URL
"
}
}
...
@@ -867,11 +876,13 @@ url_get_real_url()
...
@@ -867,11 +876,13 @@ url_get_real_url()
# don't check location if we have made form of the URL
# don't check location if we have made form of the URL
[
-n
"
$MADEURL
"
]
&&
[
"
$MADEURL
"
=
"
$URL
"
]
&&
echo
"
$URL
"
&&
return
[
-n
"
$MADEURL
"
]
&&
[
"
$MADEURL
"
=
"
$URL
"
]
&&
echo
"
$URL
"
&&
return
local
loc
=
"
$(
url_get_header
"
$URL
"
"location"
|
tail
-n1
)
"
local
loc
if
is_url
"
$loc
"
;
then
for
loc
in
$(
url_get_header
"
$URL
"
"location"
|
tac
)
;
do
echo
"
$loc
"
if
!
is_strange_url
"
$loc
"
;
then
return
echo
"
$loc
"
fi
return
fi
done
echo
"
$URL
"
echo
"
$URL
"
}
}
...
@@ -921,7 +932,9 @@ scat()
...
@@ -921,7 +932,9 @@ scat()
url_scat
"
$URL
"
url_scat
"
$URL
"
# It is list only function. Don't save to IPFS
# It is list only function. Don't save to IPFS
exit
return
###################
local
CID
=
"
$(
get_cid_by_url
"
$URL
"
)
"
local
CID
=
"
$(
get_cid_by_url
"
$URL
"
)
"
if
[
-n
"
$CID
"
]
;
then
if
[
-n
"
$CID
"
]
;
then
...
@@ -958,11 +971,11 @@ sget()
...
@@ -958,11 +971,11 @@ sget()
exit
exit
fi
fi
if
echo
"
$REALURL
"
|
grep
-q
"[?&]
"
;
then
#if is_strange_url "$REALURL
" ; then
info
"Just download strange
URL, skipping IPFS"
# info "Just download strange URL $REAL
URL, skipping IPFS"
url_sget
"
$REALURL
"
"
$TARGET
"
#
url_sget "$REALURL" "$TARGET"
return
#
return
fi
#
fi
local
CID
=
"
$(
get_cid_by_url
"
$REALURL
"
)
"
local
CID
=
"
$(
get_cid_by_url
"
$REALURL
"
)
"
if
[
-n
"
$CID
"
]
;
then
if
[
-n
"
$CID
"
]
;
then
...
...
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