fix: compatibility issue

This commit is contained in:
Carl-Robert Linnupuu 2025-02-25 23:18:22 +00:00
parent a120ce544f
commit 0e93c38e29
2 changed files with 14 additions and 11 deletions

View file

@ -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

View file

@ -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<FileWatcher>().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"),