mantisbt-plugins / VEditor

MIT License
2 stars 0 forks source link

APPLICATION ERROR #505 #5

Open dipakkumar1225 opened 4 months ago

dipakkumar1225 commented 4 months ago

APPLICATION ERROR #505

I am using MantisBT Core 2.5.1

When I attached the image in Description and submit the issue at that getting below error  

Uploaded file could not be moved to the file storage directory. Directory either does not exist or not writable to webserver.

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Changes done in config_inc.php $g_custom_headers = array( "Content-Security-Policy: " . "frame-src http://gist-it.appshot.com/ 'self'; " . "img-src https://img.shields.io/ https://secure.gravatar.com/ 'self' blob: data:; " . "default-src 'self' ; " . "frame-ancestors 'self'; " . "font-src 'self'; " . "style-src 'self' 'unsafe-inline' ; " . "script-src https://cdnjs.cloudflare.com/ http://gist-it.appspot.com/ 'self' 'unsafe-inline'" );

Changes Done in bug_api.php

function bug_get_attachments( $p_bug_id ) {

    $p_bug_id = (int)$p_bug_id;

    global $g_cache_bug_attachments;
    if( isset( $g_cache_bug_attachments[$p_bug_id] ) ) {
        return $g_cache_bug_attachments[$p_bug_id];
    }

    if (function_exists('veditor_bug_get_attachments')) {
        return veditor_bug_get_attachments($p_bug_id);
    }

    db_param_push();
    $t_query = 'SELECT id, title, diskfile, filename, filesize, file_type, date_added, user_id
                        FROM {bug_file}
                        WHERE bug_id=' . db_param() . '
                        ORDER BY date_added';
    $t_db_result = db_query( $t_query, array( $p_bug_id ) );

    $t_result = array();

    while( $t_row = db_fetch_array( $t_db_result ) ) {
        $t_result[] = $t_row;
    }

    return $t_result;
}

on edit the issue getting below error

APPLICATION ERROR #401

Database query failed. Error received from database was #1054: Unknown column 'bugnote_id' in 'field list' for the query: SELECT id, title, diskfile, filename, filesize, file_type, date_added, user_id, bugnote_id
FROM mantis_bug_file_table
WHERE bug_id=? AND title <> 'Pasted by TinyMCE' ORDER BY date_added.

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
pysiek634 commented 4 months ago

Field bugnote_id was added in version 2.23.0 . Please upgrade to the latest version. Second possibility is saving images directly in notes fields. Please remove patch from bug_api.php Unfortunately this way increases database size.

Third solution is modify VEditor.php and remove bugnote_id from field list in SQL query. (function veditor_bug_get_attachments, line 524) I'm not sure version 2.5.1 has global $g_cache_bug_attachments code. Please insert only code between #VEditor marks. Please check if this project has set valid path for attachments.