Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
File Repository
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Environments
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
File Repository
Commits
b3bd1647
Commit
b3bd1647
authored
Oct 01, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RepositoryService#getFileBytes by path removed
- Could not check permissions
parent
7a090433
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
34 deletions
+6
-34
file-repository-core/src/main/java/org/genesys/filerepository/service/RepositoryService.java
...org/genesys/filerepository/service/RepositoryService.java
+0
-10
file-repository-core/src/main/java/org/genesys/filerepository/service/impl/RepositoryServiceImpl.java
...ys/filerepository/service/impl/RepositoryServiceImpl.java
+2
-23
file-repository-core/src/test/java/org/genesys/filerepository/service/ImageGalleryThumbnailsTest.java
...ys/filerepository/service/ImageGalleryThumbnailsTest.java
+4
-1
No files found.
file-repository-core/src/main/java/org/genesys/filerepository/service/RepositoryService.java
View file @
b3bd1647
...
...
@@ -108,16 +108,6 @@ public interface RepositoryService {
*/
RepositoryFile
getFile
(
Path
path
,
String
filename
)
throws
NoSuchRepositoryFileException
,
InvalidRepositoryPathException
;
/**
* Get repository file bytes by its path and filename.
*
* @param repositoryPath path to the file
* @param filename name of the file in the storage, not original filename
* @return the file bytes
* @throws NoSuchRepositoryFileException the no such repository file exception
*/
byte
[]
getFileBytes
(
Path
repositoryPath
)
throws
NoSuchRepositoryFileException
;
/**
* Gets the file bytes.
*
...
...
file-repository-core/src/main/java/org/genesys/filerepository/service/impl/RepositoryServiceImpl.java
View file @
b3bd1647
...
...
@@ -117,11 +117,11 @@ public class RepositoryServiceImpl implements RepositoryService, InitializingBea
LOG
.
debug
(
"Updating SHA-1 and MD5 for file uuid={}"
,
repositoryFile
.
getUuid
());
}
try
{
final
byte
[]
bytes
=
getFileBytes
(
repositoryFile
.
getFolder
().
getFolderPath
().
resolve
(
repositoryFile
.
getFilename
())
);
final
byte
[]
bytes
=
getFileBytes
(
repositoryFile
);
repositoryFile
.
setSha1Sum
(
DigestUtils
.
sha1Hex
(
bytes
));
repositoryFile
.
setMd5Sum
(
DigestUtils
.
md5Hex
(
bytes
));
repositoryFilePersistence
.
save
(
repositoryFile
);
}
catch
(
final
NoSuchRepositoryFile
Exception
e
)
{
}
catch
(
final
IO
Exception
e
)
{
LOG
.
warn
(
"Failed to generate hash sums: {}"
,
e
.
getMessage
());
}
}
...
...
@@ -329,27 +329,6 @@ public class RepositoryServiceImpl implements RepositoryService, InitializingBea
return
repositoryFile
;
}
/*
* (non-Javadoc)
* @see org.genesys.filerepository.service.RepositoryService#getFileBytes
* (java.lang.String, java.lang.String)
*/
/**
* @deprecated Permission check not possible, use {@link #getFileBytes(RepositoryFile)}
*/
@Override
public
byte
[]
getFileBytes
(
final
Path
filePath
)
throws
NoSuchRepositoryFileException
{
byte
[]
data
=
null
;
try
{
data
=
bytesStorageService
.
get
(
filePath
);
}
catch
(
final
IOException
e
)
{
e
.
printStackTrace
();
}
return
data
;
}
/*
* (non-Javadoc)
* @see
...
...
file-repository-core/src/test/java/org/genesys/filerepository/service/ImageGalleryThumbnailsTest.java
View file @
b3bd1647
...
...
@@ -67,6 +67,9 @@ public class ImageGalleryThumbnailsTest extends RepositoryServiceTest {
/** The file repo service. */
@Autowired
private
RepositoryService
fileRepoService
;
@Autowired
private
BytesStorageService
bytesStorageService
;
/**
* After test.
...
...
@@ -120,7 +123,7 @@ public class ImageGalleryThumbnailsTest extends RepositoryServiceTest {
imageGalleryService
.
ensureThumbnails
(
imageGallery
,
100
,
200
);
final
byte
[]
thumbBytes1
=
fileRepoService
.
getFileBytes
(
Paths
.
get
(
ImageGalleryService
.
THUMB_PATH
,
repoImage1
.
getThumbnailPath
(),
"100x200"
+
".png"
));
final
byte
[]
thumbBytes1
=
bytesStorageService
.
get
(
Paths
.
get
(
ImageGalleryService
.
THUMB_PATH
,
repoImage1
.
getThumbnailPath
(),
"100x200"
+
".png"
));
assertThat
(
"Thumbnail must not be null"
,
thumbBytes1
,
notNullValue
());
try
(
InputStream
is
=
new
ByteArrayInputStream
(
thumbBytes1
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment