cubecart / v6

CubeCart Version 6
https://cubecart.com
71 stars 59 forks source link

`CubeCart_filemanager` `md5hash` shouldn't be unique #3555

Closed abrookbanks closed 2 months ago

abrookbanks commented 2 months ago

I've seen many stores with the same file with different names.

Do we need this to be unique? Do we need it at all?

abrookbanks commented 2 months ago

Apparently so;

// Hash comparison check
                    $checkhash = $GLOBALS['db']->select('CubeCart_filemanager', array('file_id'), array('type' => $this->_mode, 'md5hash' => $record['md5hash'], 'filepath' => $record['filepath'], 'filename' => $record['filename']), false, 1);
                    if (!$checkhash) {
                        $GLOBALS['db']->insert('CubeCart_filemanager', $record);
                        $updated = true;
                    } else {
                        if ($tidy) {
                            unlink($file);
                        }
                    }
abrookbanks commented 2 months ago

It should be unique but this can be messed up if a merchant upload duplicate files via FTP.