fix(symlink): remove target directory upon symlink creation

For some shared hosting (such as ovh's), having the full target link will raise 403 errors.
The target directory is she same as the link directory so it is useless.
This commit is contained in:
Benjamin Bellamy 2023-09-14 11:10:20 +02:00 committed by GitHub
parent a36f2534a0
commit 8f92793742
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,7 +159,7 @@ class Pages extends dbJSON {
}
// Create symlink for the upload directory
if (symlink(PATH_UPLOADS_PAGES.$row['uuid'], PATH_UPLOADS_PAGES.$key) === false) {
if (symlink($row['uuid'], PATH_UPLOADS_PAGES.$key) === false) {
Log::set(__METHOD__.LOG_SEP.'An error occurred while trying to create the symlink: '.PATH_UPLOADS_PAGES.$key, LOG_TYPE_ERROR);
return false;
}
@ -291,7 +291,7 @@ class Pages extends dbJSON {
// Regenerate the symlink to a proper directory
unlink(PATH_UPLOADS_PAGES.$key);
if (symlink(PATH_UPLOADS_PAGES.$row['uuid'], PATH_UPLOADS_PAGES.$newKey) === false) {
if (symlink($row['uuid'], PATH_UPLOADS_PAGES.$newKey) === false) {
Log::set(__METHOD__.LOG_SEP.'An error occurred while trying to move the directory: '.PATH_UPLOADS_PAGES.$newKey, LOG_TYPE_ERROR);
return false;
}