GP-5707 fix getinfo FSB action project index

Also tweak tar filename info string
This commit is contained in:
dev747368 2025-05-20 18:05:53 +00:00
parent 795d92cb1a
commit 2c894df34c
4 changed files with 11 additions and 13 deletions

View file

@ -103,8 +103,7 @@ public class FSBComponentProvider extends ComponentProviderAdapter
}
void initFileHandlers() {
FSBFileHandlerContext context =
new FSBFileHandlerContext(plugin, this, fsService, projectIndex);
FSBFileHandlerContext context = new FSBFileHandlerContext(plugin, this, fsService);
fileHandlers = ClassSearcher.getInstances(FSBFileHandler.class);
for (FSBFileHandler fileHandler : fileHandlers) {
fileHandler.init(context);

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -16,7 +16,6 @@
package ghidra.plugins.fsbrowser;
import ghidra.formats.gfilesystem.FileSystemService;
import ghidra.plugin.importer.ProjectIndexService;
/**
* Context given to a {@link FSBFileHandler} instance when being initialized.
@ -24,8 +23,6 @@ import ghidra.plugin.importer.ProjectIndexService;
* @param plugin the FSB plugin
* @param fsbComponent the FSB component
* @param fsService the fs service
* @param projectIndex the project index
*/
public record FSBFileHandlerContext(FileSystemBrowserPlugin plugin,
FSBComponentProvider fsbComponent, FileSystemService fsService,
ProjectIndexService projectIndex) {}
FSBComponentProvider fsbComponent, FileSystemService fsService) {}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -105,7 +105,8 @@ public class GetInfoFSBFileHandler implements FSBFileHandler {
}
fattrs = fattrs.clone();
DomainFile associatedDomainFile = context.projectIndex().findFirstByFSRL(fsrl);
DomainFile associatedDomainFile =
context.fsbComponent().getProjectIndex().findFirstByFSRL(fsrl);
if (associatedDomainFile != null) {
fattrs.add(PROJECT_FILE_ATTR, associatedDomainFile.getPathname());
}

View file

@ -21,6 +21,7 @@ import java.io.IOException;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.io.FilenameUtils;
import ghidra.app.util.bin.ByteProvider;
import ghidra.formats.gfilesystem.*;
@ -112,7 +113,7 @@ public class TarFileSystem extends AbstractFileSystem<TarMetadata> {
}
TarArchiveEntry blob = tmd.tarArchiveEntry;
return FileAttributes.of(
FileAttribute.create(NAME_ATTR, blob.getName()),
FileAttribute.create(NAME_ATTR, FilenameUtils.getName(blob.getName())),
FileAttribute.create(SIZE_ATTR, blob.getSize()),
FileAttribute.create(MODIFIED_DATE_ATTR, blob.getLastModifiedDate()),
FileAttribute.create(FILE_TYPE_ATTR, tarToFileType(blob)),
@ -155,7 +156,7 @@ public class TarFileSystem extends AbstractFileSystem<TarMetadata> {
int fileNum = 0;
TarArchiveEntry tarEntry;
while ((tarEntry = tarInput.getNextTarEntry()) != null) {
while ((tarEntry = tarInput.getNextEntry()) != null) {
if (fileNum == tmd.fileNum) {
if (!tmd.tarArchiveEntry.getName().equals(tarEntry.getName())) {
throw new IOException(