diff options
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | js/pomf.js | 11 | ||||
| -rw-r--r-- | static/upload.php | 2 |
3 files changed, 8 insertions, 9 deletions
@@ -37,8 +37,8 @@ however, client-side configuration for max size, the `data-max-size` attribute on the file input in `pages/upload_form.swig`. Make sure to disable PHP from being executed on the file download -domain/directory (e.g a.site.com), otherwise a attacker can upload a malicious -.php file and execute it on your server. +domain/directory (e.g., `a.pomf.example`), otherwise an attacker can upload a +malicious `.php` file and execute it on your server. ### Apache @@ -1,5 +1,6 @@ /** * Copyright (c) 2013 Peter Lejeck <peter.lejeck@gmail.com> + * Copyright (c) 2015 the Pantsu.cat developers <hostmaster@pantsu.cat> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -103,11 +104,12 @@ $(function() { var totalRow = createRow('', files.humanSize, 'total'); totalRow.appendTo(uploadFiles); + var totalName = $('.file-name', totalRow); + if (files.size > MAX_SIZE) { uploadFiles.addClass('error'); - $('.file-name', totalRow).html('onii-chan y-your upload is t-too ' + - 'big…'); + totalName.html('onii-chan y-your upload is t-too big…'); return; } @@ -123,8 +125,6 @@ $(function() { }); }; - var totalName = $('.file-name', totalRow); - up.on('uploadprogress', function(e, files) { eachRow(files, function(row, file, files) { $('.progress-inner', row).width((file.percentUploaded * 100) + '%'); @@ -143,8 +143,7 @@ $(function() { var res = JSON.parse(res); if (!res.success) { uploadFiles.addClass('error'); - $('.file-name', totalRow).text('Something went wrong; try again ' + - 'later.'); + totalName.text('Something went wrong; try again later.'); break; } eachRow(res.files, function(row, file, files) { diff --git a/static/upload.php b/static/upload.php index c501acd..9703ede 100644 --- a/static/upload.php +++ b/static/upload.php @@ -66,7 +66,7 @@ function generate_name($file) do { // Iterate until we reach the maximum number of retries - if ($tries-- == 0) { + if ($tries-- === 0) { throw new Exception('Gave up trying to find an unused name', 500); } |
