Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
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
Harbor 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
dCache
cta
Commits
5871807a
Commit
5871807a
authored
16 years ago
by
Giuseppe Lo Presti
Browse files
Options
Downloads
Patches
Plain Diff
Added support for dropping '/./' on normalizing paths + added an extended
comment on known limitations of the normalizePath function
parent
24c5a5f5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
castor/db/oracleCommon.sql
+9
-4
9 additions, 4 deletions
castor/db/oracleCommon.sql
with
9 additions
and
4 deletions
castor/db/oracleCommon.sql
+
9
−
4
View file @
5871807a
/*******************************************************************
*
* @(#)$RCSfile: oracleCommon.sql,v $ $Revision: 1.69
5
$ $Date: 2009/04/
06 14:29:16
$ $Author: itglp $
* @(#)$RCSfile: oracleCommon.sql,v $ $Revision: 1.69
6
$ $Date: 2009/04/
20 13:13:24
$ $Author: itglp $
*
* This file contains some common PL/SQL utilities for the stager database.
*
...
...
@@ -135,11 +135,16 @@ CREATE OR REPLACE FUNCTION normalizePath(path IN VARCHAR2) RETURN VARCHAR2 IS
buf
VARCHAR2
(
2048
);
ret
VARCHAR2
(
2048
);
BEGIN
ret
:
=
REGEXP_REPLACE
(
path
,
'(/){2,}'
,
'/'
);
-- drop '.'s snd multiple '/'s
ret
:
=
replace
(
regexp_replace
(
path
,
'[/]+'
,
'/'
),
'/./'
,
'/'
);
LOOP
buf
:
=
ret
;
-- a path component is by definition anything between two slashes
ret
:
=
REGEXP_REPLACE
(
buf
,
'/[^/]+/
\.\.
/'
,
'/'
);
-- a path component is by definition anything between two slashes, except
-- the '..' string itself. This is not taken into account, resulting in incorrect
-- parsing when relative paths are used (see bug #49002). We're not concerned by
-- those cases; however this code could be fixed and improved by using string
-- tokenization as opposed to expensive regexp parsing.
ret
:
=
regexp_replace
(
buf
,
'/[^/]+/
\.\.
/'
,
'/'
);
EXIT
WHEN
ret
=
buf
;
END
LOOP
;
RETURN
ret
;
...
...
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