Skip to content

Commit

Permalink
Set release as passworded if files inside archives are passworded
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Aug 16, 2019
1 parent bfa2cd9 commit 58761de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
15 changes: 9 additions & 6 deletions Blacklight/processing/post/ProcessAdditional.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class ProcessAdditional

/**
* Password status of the current release.
* @var array
* @var string
*/
protected $_passwordStatus;

Expand Down Expand Up @@ -1087,7 +1087,7 @@ protected function _processCompressedData(&$compressedData): bool
$this->_debug('ArchiveInfo: Compressed file has a password.');
}
$this->_releaseHasPassword = true;
$this->_passwordStatus[] = Releases::PASSWD_RAR;
$this->_passwordStatus = Releases::PASSWD_RAR;

return false;
}
Expand Down Expand Up @@ -1154,13 +1154,13 @@ protected function _processCompressedFileList(): bool

if (isset($file['pass']) && $file['pass'] === true) {
$this->_releaseHasPassword = true;
$this->_passwordStatus[] = Releases::PASSWD_RAR;
$this->_passwordStatus = Releases::PASSWD_RAR;
break;
}

if ($this->_innerFileBlacklist !== false && preg_match($this->_innerFileBlacklist, $file['name'])) {
$this->_releaseHasPassword = true;
$this->_passwordStatus[] = Releases::PASSWD_POTENTIAL;
$this->_passwordStatus = Releases::PASSWD_POTENTIAL;
break;
}

Expand Down Expand Up @@ -1215,6 +1215,9 @@ protected function _addFileInfo(&$file): void
['size'], ])->first() === null) {
if (ReleaseFile::addReleaseFiles($this->_release->id, $file['name'], $file['size'], $file['date'], $file['pass'], '', $file['crc32'] ?? '')) {
$this->_addedFileInfo++;
if ((int) $file['pass'] === 1) {
$this->_passwordStatus = Releases::PASSWD_RAR;
}

if ($this->_echoCLI) {
$this->_echo('^', 'primaryOver');
Expand All @@ -1228,7 +1231,7 @@ protected function _addFileInfo(&$file): void
$this->_debug('Codec spam found, setting release to potentially passworded.');
}
$this->_releaseHasPassword = true;
$this->_passwordStatus[] = Releases::PASSWD_POTENTIAL;
$this->_passwordStatus = Releases::PASSWD_POTENTIAL;
} //Run a PreDB filename check on insert to try and match the release
elseif ($file['name'] !== '' && strpos($file['name'], '.') !== 0) {
$this->_release['filename'] = $file['name'];
Expand Down Expand Up @@ -2297,7 +2300,7 @@ protected function _resetReleaseStatus(): void
$this->_foundSample = $this->_processThumbnails ? false : true;
$this->_foundPAR2Info = false;

$this->_passwordStatus = [Releases::PASSWD_NONE];
$this->_passwordStatus = Releases::PASSWD_NONE;
$this->_releaseHasPassword = false;

$this->_releaseGroupName = UsenetGroup::getNameByID($this->_release->groups_id);
Expand Down
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2019-08-16 DariusIII
* Chg: Set release as passworded if files inside archives are passworded
* Chg: Update tinyMCE config
* Fix: Fix opening existing forum posts
* Fix: Fix bad order of variables in PostProcess class
Expand Down
2 changes: 1 addition & 1 deletion captainhook.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams",
"options": {
"subjectLength": 50,
"subjectLength": 200,
"bodyLineLength": 72
},
"conditions": []
Expand Down

0 comments on commit 58761de

Please sign in to comment.