fix: correct readLog parameters for Supervisor XML-RPC API
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 1m13s

Fixed the readLog() call to use the correct parameters for reading
from the end of the log file. When using a negative offset to read
the last N bytes, the length parameter must be 0, not a positive number.

Changes:
- Updated fetchMainLog default length from 4096 to 0
- Updated API route default length from '4096' to '0'

Correct usage:
- readLog(-4096, 0) - Read last 4096 bytes from end of file
- readLog(0, 4096) - Read 4096 bytes from start of file

This fixes the INCORRECT_PARAMETERS error when fetching the main
supervisord log.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-23 22:59:22 +01:00
parent bdec163fb0
commit 2d5ffac56c
2 changed files with 2 additions and 2 deletions

View File

@@ -7,7 +7,7 @@ export const dynamic = 'force-dynamic';
export const GET = withLogging(async (request: NextRequest) => {
const searchParams = request.nextUrl.searchParams;
const offset = parseInt(searchParams.get('offset') || '-4096', 10);
const length = parseInt(searchParams.get('length') || '4096', 10);
const length = parseInt(searchParams.get('length') || '0', 10);
const client = createSupervisorClient();
const logs = await client.readLog(offset, length);

View File

@@ -210,7 +210,7 @@ export function useRestartProcess() {
// Log Management
async function fetchMainLog(offset: number = -4096, length: number = 4096): Promise<{ logs: string }> {
async function fetchMainLog(offset: number = -4096, length: number = 0): Promise<{ logs: string }> {
const response = await fetch(`/api/supervisor/logs?offset=${offset}&length=${length}`);
if (!response.ok) {
const error = await response.json();