Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eget
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
eget
Commits
f98869a1
Commit
f98869a1
authored
Feb 08, 2026
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: replace grep with case in URL type checking functions
parent
e2732ae8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
eget
eget
+31
-18
No files found.
eget
View file @
f98869a1
...
...
@@ -212,18 +212,24 @@ filter_order()
have_end_slash_or_php_parametr
()
{
echo
"
$1
"
|
grep
-qE
'(/$|\.php($|\?))'
case
"
$1
"
in
*
/
)
return
0
;;
*
.php|
*
.php
\?
*
)
return
0
;;
esac
return
1
}
is_abs_path
()
{
echo
"
$1
"
|
grep
-q
'^/'
case
"
$1
"
in
/
*
)
return
0
;;
esac
return
1
}
is_fileurl
()
{
is_abs_path
"
$1
"
&&
return
echo
"
$1
"
|
grep
-q
"^file:/"
case
"
$1
"
in
file:/
*
)
return
0
;;
esac
return
1
}
path_from_url
()
...
...
@@ -233,53 +239,59 @@ path_from_url()
is_url
()
{
echo
"
$1
"
|
grep
-q
"^[filehtps]*:/"
case
"
$1
"
in
file:/
*
|
http:/
*
|
https:/
*
|
ftp:/
*
|
ftps:/
*
|
ipfs:/
*
)
return
0
;;
esac
return
1
}
is_strange_url
()
{
local
URL
=
"
$1
"
is_url
"
$URL
"
||
return
#echo "$URL" | grep -q -E "\.(deb|rpm|zip)\?" && return 1
echo
"
$URL
"
|
grep
-q
"[?&]"
#case "$URL" in *.deb\?*|*.rpm\?*|*.zip\?*) return 1 ;; esac
case
"
$URL
"
in
*
"?"
*
|
*
"&"
*
)
return
0
;;
esac
return
1
}
is_ipfs_hash
()
{
# If a CID is 46 characters starting with "Qm", it's a CIDv0
echo
"
$1
"
|
grep
-q
-E
"^Qm[[:alnum:]]{44}$"
&&
return
# CIDv0: starts with Qm, 46 chars, alphanumeric only
case
"
$1
"
in
Qm
*
)
;;
*
)
return
1
;;
esac
case
"
$1
"
in
*
[!
A-Za-z0-9]
*
)
return
1
;;
esac
# TODO: CIDv1 support, see https://github.com/multiformats/cid
return
1
[
"
${#
1
}
"
=
46
]
}
is_ipfsurl
()
{
is_ipfs_hash
"
$1
"
&&
return
echo
"
$1
"
|
grep
-q
"^ipfs://"
case
"
$1
"
in
ipfs://
*
)
return
0
;;
esac
return
1
}
is_httpurl
()
{
# TODO: improve
echo
"
$1
"
|
grep
-q
"^https://"
&&
return
echo
"
$1
"
|
grep
-q
"^http://"
&&
return
case
"
$1
"
in
http://
*
|
https://
*
)
return
0
;;
esac
return
1
}
is_ftpurl
()
{
echo
"
$1
"
|
grep
-q
"^ftp://"
case
"
$1
"
in
ftp://
*
)
return
0
;;
esac
return
1
}
is_rsyncurl
()
{
echo
"
$1
"
|
grep
-q
"^rsync://"
case
"
$1
"
in
rsync://
*
)
return
0
;;
esac
return
1
}
# SSH/rsync URL: user@host:/path or host:/path (but not scheme://)
is_sshurl
()
{
# Match host:path or host:/path, but not scheme://
echo
"
$1
"
|
grep
-qE
'^[^/:]+:'
&&
!
echo
"
$1
"
|
grep
-q
"://"
# Exclude scheme:// first, then match host:path
case
"
$1
"
in
*
://
*
)
return
1
;;
*
:
*
)
return
0
;;
esac
return
1
}
cid_from_url
()
...
...
@@ -289,7 +301,8 @@ cid_from_url()
is_numeric
()
{
echo
"
$1
"
|
grep
-qE
'^[0-9]+$'
case
"
$1
"
in
*
[!
0-9]
*
|
''
)
return
1
;;
esac
return
0
}
# Calculate average with outlier filtering (2σ rule)
...
...
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