Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MAX_ROWS option for CSV rendering #30268

Merged
merged 12 commits into from
Jun 6, 2024
Merged

Commits on May 26, 2024

  1. Fix CSV rendering (go-gitea#29663)

    Fixes go-gitea#29663
    
    Previously, when a CSV file was larger than the limit, the render function lost its function to render the code. There were also multiple reads to the file, in order to determine its size and render or pre-render.
    
    This solution implements a new config variable MAX_ROWS, which corresponds to the “Maximum allowed rows to render CSV files. (0 for no limit)” and rewrites the Render function for CSV files in markup module. Now the render function only reads the file once, having MAX_FILE_SIZE+1 as a reader limit and MAX_ROWS as a row limit. When the file is larger than MAX_FILE_SIZE or has more rows than MAX_ROWS, it only renders until the limit, and displays a user-friendly warning informing that the rendered data is not complete, in the user's language.
    
    The warning: ![image](https://s3.amazonaws.com/i.snag.gy/ieROGx.jpg)
    HenriquerPimentel committed May 26, 2024
    Configuration menu
    Copy the full SHA
    2c57283 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    96c5e3c View commit details
    Browse the repository at this point in the history
  3. Update MaxRow

    HenriquerPimentel committed May 26, 2024
    Configuration menu
    Copy the full SHA
    1196da3 View commit details
    Browse the repository at this point in the history
  4. Fix row numbering

    Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
    HenriquerPimentel and lunny committed May 26, 2024
    Configuration menu
    Copy the full SHA
    0c2f777 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    271c274 View commit details
    Browse the repository at this point in the history
  6. Small upgrades

    - Removed tags from sanitizer rules;
    - The warning message now is a table (to reuse UI elements);
    - ctx.RelativePath escaped;
    - Implemented a panic catch when getting a translation error;
    HenriquerPimentel committed May 26, 2024
    Configuration menu
    Copy the full SHA
    0656f41 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f095a38 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0831da7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ec0688b View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2024

  1. Configuration menu
    Copy the full SHA
    e200869 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aef77ce View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d5a3c93 View commit details
    Browse the repository at this point in the history