mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-5707 fix getinfo FSB action project index
Also tweak tar filename info string
This commit is contained in:
parent
795d92cb1a
commit
2c894df34c
4 changed files with 11 additions and 13 deletions
|
@ -103,8 +103,7 @@ public class FSBComponentProvider extends ComponentProviderAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
void initFileHandlers() {
|
void initFileHandlers() {
|
||||||
FSBFileHandlerContext context =
|
FSBFileHandlerContext context = new FSBFileHandlerContext(plugin, this, fsService);
|
||||||
new FSBFileHandlerContext(plugin, this, fsService, projectIndex);
|
|
||||||
fileHandlers = ClassSearcher.getInstances(FSBFileHandler.class);
|
fileHandlers = ClassSearcher.getInstances(FSBFileHandler.class);
|
||||||
for (FSBFileHandler fileHandler : fileHandlers) {
|
for (FSBFileHandler fileHandler : fileHandlers) {
|
||||||
fileHandler.init(context);
|
fileHandler.init(context);
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
package ghidra.plugins.fsbrowser;
|
package ghidra.plugins.fsbrowser;
|
||||||
|
|
||||||
import ghidra.formats.gfilesystem.FileSystemService;
|
import ghidra.formats.gfilesystem.FileSystemService;
|
||||||
import ghidra.plugin.importer.ProjectIndexService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context given to a {@link FSBFileHandler} instance when being initialized.
|
* 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 plugin the FSB plugin
|
||||||
* @param fsbComponent the FSB component
|
* @param fsbComponent the FSB component
|
||||||
* @param fsService the fs service
|
* @param fsService the fs service
|
||||||
* @param projectIndex the project index
|
|
||||||
*/
|
*/
|
||||||
public record FSBFileHandlerContext(FileSystemBrowserPlugin plugin,
|
public record FSBFileHandlerContext(FileSystemBrowserPlugin plugin,
|
||||||
FSBComponentProvider fsbComponent, FileSystemService fsService,
|
FSBComponentProvider fsbComponent, FileSystemService fsService) {}
|
||||||
ProjectIndexService projectIndex) {}
|
|
||||||
|
|
|
@ -105,7 +105,8 @@ public class GetInfoFSBFileHandler implements FSBFileHandler {
|
||||||
}
|
}
|
||||||
fattrs = fattrs.clone();
|
fattrs = fattrs.clone();
|
||||||
|
|
||||||
DomainFile associatedDomainFile = context.projectIndex().findFirstByFSRL(fsrl);
|
DomainFile associatedDomainFile =
|
||||||
|
context.fsbComponent().getProjectIndex().findFirstByFSRL(fsrl);
|
||||||
if (associatedDomainFile != null) {
|
if (associatedDomainFile != null) {
|
||||||
fattrs.add(PROJECT_FILE_ATTR, associatedDomainFile.getPathname());
|
fattrs.add(PROJECT_FILE_ATTR, associatedDomainFile.getPathname());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
|
||||||
import ghidra.app.util.bin.ByteProvider;
|
import ghidra.app.util.bin.ByteProvider;
|
||||||
import ghidra.formats.gfilesystem.*;
|
import ghidra.formats.gfilesystem.*;
|
||||||
|
@ -112,7 +113,7 @@ public class TarFileSystem extends AbstractFileSystem<TarMetadata> {
|
||||||
}
|
}
|
||||||
TarArchiveEntry blob = tmd.tarArchiveEntry;
|
TarArchiveEntry blob = tmd.tarArchiveEntry;
|
||||||
return FileAttributes.of(
|
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(SIZE_ATTR, blob.getSize()),
|
||||||
FileAttribute.create(MODIFIED_DATE_ATTR, blob.getLastModifiedDate()),
|
FileAttribute.create(MODIFIED_DATE_ATTR, blob.getLastModifiedDate()),
|
||||||
FileAttribute.create(FILE_TYPE_ATTR, tarToFileType(blob)),
|
FileAttribute.create(FILE_TYPE_ATTR, tarToFileType(blob)),
|
||||||
|
@ -155,7 +156,7 @@ public class TarFileSystem extends AbstractFileSystem<TarMetadata> {
|
||||||
|
|
||||||
int fileNum = 0;
|
int fileNum = 0;
|
||||||
TarArchiveEntry tarEntry;
|
TarArchiveEntry tarEntry;
|
||||||
while ((tarEntry = tarInput.getNextTarEntry()) != null) {
|
while ((tarEntry = tarInput.getNextEntry()) != null) {
|
||||||
if (fileNum == tmd.fileNum) {
|
if (fileNum == tmd.fileNum) {
|
||||||
if (!tmd.tarArchiveEntry.getName().equals(tarEntry.getName())) {
|
if (!tmd.tarArchiveEntry.getName().equals(tarEntry.getName())) {
|
||||||
throw new IOException(
|
throw new IOException(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue