From 0e93c38e29449cfecdbd4361368d9fe8a1440484 Mon Sep 17 00:00:00 2001 From: Carl-Robert Linnupuu Date: Tue, 25 Feb 2025 23:18:22 +0000 Subject: [PATCH] fix: compatibility issue --- CHANGELOG.md | 11 ++--------- .../carlrobert/codegpt/CodeGPTProjectActivity.kt | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 686b832e..f8373841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,13 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Claude 3.7 Sonnet model (CodeGPT) -## [2.17.0-241.1] - 2025-02-12 - -### Renamed - -- Plugin name - -## [2.16.3-233] - 2025-02-11 +## [2.16.3-241.1] - 2025-02-11 ### Added @@ -912,8 +906,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `OPENAI_API_KEY` persistence, key is saved in the OS password safe from now on -[Unreleased]: https://github.com/carlrobertoh/CodeGPT/compare/v2.17.0-233...HEAD -[2.17.0-233]: https://github.com/carlrobertoh/CodeGPT/compare/v2.16.3-233...v2.17.0-233 +[Unreleased]: https://github.com/carlrobertoh/CodeGPT/compare/v2.16.3-233...HEAD [2.16.3-233]: https://github.com/carlrobertoh/CodeGPT/compare/v2.16.2-233...v2.16.3-233 [2.16.2-233]: https://github.com/carlrobertoh/CodeGPT/compare/v2.16.1-233...v2.16.2-233 [2.16.1-233]: https://github.com/carlrobertoh/CodeGPT/compare/v2.16.0-233...v2.16.1-233 diff --git a/src/main/kotlin/ee/carlrobert/codegpt/CodeGPTProjectActivity.kt b/src/main/kotlin/ee/carlrobert/codegpt/CodeGPTProjectActivity.kt index b673096a..776b79e7 100644 --- a/src/main/kotlin/ee/carlrobert/codegpt/CodeGPTProjectActivity.kt +++ b/src/main/kotlin/ee/carlrobert/codegpt/CodeGPTProjectActivity.kt @@ -13,7 +13,7 @@ import ee.carlrobert.codegpt.settings.service.ServiceType import ee.carlrobert.codegpt.settings.service.codegpt.CodeGPTService import ee.carlrobert.codegpt.toolwindow.chat.ui.textarea.AttachImageNotifier import ee.carlrobert.codegpt.ui.OverlayUtil -import io.ktor.util.* +import java.nio.file.Path import java.nio.file.Paths import kotlin.io.path.absolutePathString @@ -34,7 +34,7 @@ class CodeGPTProjectActivity : ProjectActivity { ) { val desktopPath = Paths.get(System.getProperty("user.home"), "Desktop") project.service().watch(desktopPath) { - if (watchExtensions.contains(it.extension.lowercase())) { + if (watchExtensions.contains(getFileExtension(it))) { showImageAttachmentNotification( project, desktopPath.resolve(it).absolutePathString() @@ -44,6 +44,16 @@ class CodeGPTProjectActivity : ProjectActivity { } } + private fun getFileExtension(path: Path): String { + val fileName = path.fileName.toString() + val lastIndexOfDot = fileName.lastIndexOf('.') + return if (lastIndexOfDot != -1) { + fileName.substring(lastIndexOfDot + 1).lowercase() + } else { + "" + } + } + private fun showImageAttachmentNotification(project: Project, filePath: String) { OverlayUtil.getDefaultNotification( CodeGPTBundle.get("imageAttachmentNotification.content"),