From 00ec914f3cdc951b374b974cf266759bb9a1974e Mon Sep 17 00:00:00 2001 From: Rima Shah <22248619+rimashah25@users.noreply.github.com> Date: Tue, 14 May 2024 09:23:46 -0600 Subject: [PATCH] Fix czf temp file issue in Traffic Router (#8008) Co-authored-by: Parthiban, Jagan --- CHANGELOG.md | 1 + .../traffic_router/core/loc/AbstractServiceUpdater.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd0807153..d3a65b2ef9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - [#7933](https://github.com/apache/trafficcontrol/pull/7933), [#8005](https://github.com/apache/trafficcontrol/pull/8005) *Traffic Portal v2*: Update NodeJS version to 18. ### Fixed +- [#8008](https://github.com/apache/trafficcontrol/pull/8008) *Traffic Router* Fix czf temp file deletion issue. - [#7998](https://github.com/apache/trafficcontrol/pull/7998) *Traffic Portalv2* Fixed (create and update) page titles across every feature - [#7984](https://github.com/apache/trafficcontrol/pull/7984) *Traffic Ops* Fixed TO Client cert authentication with respect to returning response cookie. - [#7957](https://github.com/apache/trafficcontrol/pull/7957) *Traffic Ops* Fix the incorrect display of delivery services assigned to ORG servers. diff --git a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/AbstractServiceUpdater.java b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/AbstractServiceUpdater.java index f1d8c7fbd7..a770a7eb0b 100644 --- a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/AbstractServiceUpdater.java +++ b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/AbstractServiceUpdater.java @@ -376,16 +376,19 @@ protected File downloadDatabase(final String url, final File existingDb) throws eTag = conn.getHeaderField("ETag"); if (((HttpURLConnection) conn).getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) { LOGGER.info("[" + getClass().getSimpleName() + "] " + url + " not modified since our existing database's last update time of " + new Date(existingLastModified)); + outputFile.delete(); return existingDb; } } else if (dbURL.getProtocol().equals("file") && conn.getLastModified() > 0 && conn.getLastModified() <= existingLastModified) { LOGGER.info("[" + getClass().getSimpleName() + "] " + url + " not modified since our existing database's last update time of " + new Date(existingLastModified)); + outputFile.delete(); return existingDb; } IOUtils.copy(sourceCompressed ? new GZIPInputStream(in) : in, out); } + return outputFile; }