summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-17 01:17:17 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-17 06:15:17 +0100
commitf007f32958a7c875db6cb2e79c09ab0965477a2a (patch)
tree572e5016cd7742416c1065d3ddf8bf6c0f79ee61
parenteec32be26d5d5805c1cb8cb53ce9702c04829819 (diff)
tdf#145711: filename may be 1-character, and must not contain path separator
Surfaced after 6ea7ca45782a7e1b46e18e994534ec0a7c71951b Change-Id: I4975f51a7a0ca73eccfd17338abc122254b57113 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125338 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--solenv/bin/modules/installer/pathanalyzer.pm4
-rw-r--r--solenv/bin/modules/pre2par/pathanalyzer.pm5
2 files changed, 5 insertions, 4 deletions
diff --git a/solenv/bin/modules/installer/pathanalyzer.pm b/solenv/bin/modules/installer/pathanalyzer.pm
index 7f3f68a4edb2..312042acb1a0 100644
--- a/solenv/bin/modules/installer/pathanalyzer.pm
+++ b/solenv/bin/modules/installer/pathanalyzer.pm
@@ -47,7 +47,7 @@ sub make_absolute_filename_to_relative_filename
if ( $installer::globals::isunix )
{
- if ( $$longfilenameref =~ /^.*\/(\S.+\S?)/ )
+ if ( $$longfilenameref =~ /^.*\/(?=\S)([^\/]+)(?<=\S)/ )
{
$$longfilenameref = $1;
}
@@ -56,7 +56,7 @@ sub make_absolute_filename_to_relative_filename
if ( $installer::globals::iswin )
{
# Either '/' or '\'. It would be possible to use $installer::globals::separator.
- if ( $$longfilenameref =~ /^.*[\/\\](\S.+\S?)/ )
+ if ( $$longfilenameref =~ /^.*[\/\\](?=\S)([^\/\\]+)(?<=\S)/ )
{
$$longfilenameref = $1;
}
diff --git a/solenv/bin/modules/pre2par/pathanalyzer.pm b/solenv/bin/modules/pre2par/pathanalyzer.pm
index 0aefcd1b43c8..4d2eb31ae073 100644
--- a/solenv/bin/modules/pre2par/pathanalyzer.pm
+++ b/solenv/bin/modules/pre2par/pathanalyzer.pm
@@ -48,7 +48,7 @@ sub make_absolute_filename_to_relative_filename
if ( $pre2par::globals::isunix )
{
- if ( $$longfilenameref =~ /^.*\/(\S.+\S?)/ )
+ if ( $$longfilenameref =~ /^.*\/(?=\S)([^\/]+)(?<=\S)/ )
{
$$longfilenameref = $1;
}
@@ -56,7 +56,8 @@ sub make_absolute_filename_to_relative_filename
if ( $pre2par::globals::iswin )
{
- if ( $$longfilenameref =~ /^.*\\(\S.+\S?)/ )
+ # Either '/' or '\'.
+ if ( $$longfilenameref =~ /^.*[\/\\](?=\S)([^\/\\]+)(?<=\S)/ )
{
$$longfilenameref = $1;
}