[aur-dev] [PATCH] pkgsubmit.php: Check that there is one directory in a tarball

2012-10-28 Thread canyonknight
Users are able to upload tarballs without a directory.
The directory count for a tarball is available, so use it to
display an error when there is not a single directory.

This patch has no effect on users who generate their uploaded
tarballs using makepkg. All other users must include a directory
in their tarball.

Signed-off-by: canyonknight canyonkni...@gmail.com
---

The error message isn't great. But this avoids messing up the string freeze.

 web/html/pkgsubmit.php | 4 
 1 file changed, 4 insertions(+)

diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index efd90e1..885c44f 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -106,6 +106,10 @@ if ($uid):
}
}
 
+   if (!$error  $dircount !== 1) {
+   $error = __(Error - source tarball may not 
contain files outside a directory.);
+   }
+
if (!$error  empty($pkgbuild_raw)) {
$error = __(Error trying to unpack upload - 
PKGBUILD does not exist.);
}
-- 
1.8.0



Re: [aur-dev] [PATCH] pkgsubmit.php: Check that there is one directory in a tarball

2012-10-28 Thread Dave Reisner
On Sun, Oct 28, 2012 at 9:04 PM, canyonknight canyonkni...@gmail.comwrote:

 Users are able to upload tarballs without a directory.
 The directory count for a tarball is available, so use it to
 display an error when there is not a single directory.

 This patch has no effect on users who generate their uploaded
 tarballs using makepkg. All other users must include a directory
 in their tarball.

 Signed-off-by: canyonknight canyonkni...@gmail.com
 ---

 The error message isn't great. But this avoids messing up the string
 freeze.


Yay! Thanks for doing this.


  web/html/pkgsubmit.php | 4 
  1 file changed, 4 insertions(+)

 diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
 index efd90e1..885c44f 100644
 --- a/web/html/pkgsubmit.php
 +++ b/web/html/pkgsubmit.php
 @@ -106,6 +106,10 @@ if ($uid):
 }
 }

 +   if (!$error  $dircount !== 1) {
 +   $error = __(Error - source tarball may
 not contain files outside a directory.);
 +   }
 +
 if (!$error  empty($pkgbuild_raw)) {
 $error = __(Error trying to unpack upload
 - PKGBUILD does not exist.);
 }
 --
 1.8.0