Skip to content

Commit

Permalink
Merge pull request #55 from contentstack/hotfix/img_content_type
Browse files Browse the repository at this point in the history
fix: fixed null content type issue
  • Loading branch information
aravindbuilt authored Mar 28, 2024
2 parents be3ed08 + 1543964 commit 6f95251
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v1.3.2

### March 28, 2024

- Fix:
- fixed null content type issue

## v1.3.1

### Feb 22, 2024
Expand Down
8 changes: 6 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<artifactId>cms</artifactId>
<packaging>jar</packaging>
<name>contentstack-management-java</name>
<version>1.3.1</version>
<version>1.3.2</version>
<description>Contentstack Java Management SDK for Content Management API, Contentstack is a headless CMS with an
API-first approach
</description>
Expand Down Expand Up @@ -177,7 +177,11 @@
<version>1.1.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>


Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/contentstack/cms/stack/FileUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Objects;

import javax.activation.MimetypesFileTypeMap;

public class FileUploader {


Expand Down Expand Up @@ -49,7 +51,9 @@ private void addFormDataPartIfNotNull(MultipartBody.Builder builder, String name
// Helper method to get content type of file
private String getContentType(File file) {
try {
return Files.probeContentType(file.toPath());
java.nio.file.Path source = Paths.get(file.toString());
MimetypesFileTypeMap m = new MimetypesFileTypeMap(source.toString());
return m.getContentType(file);
} catch (IOException e) {
throw new RuntimeException("Failed to determine content type of file", e);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/contentstack/cms/stack/Merge.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* @author ***REMOVED***
* @version v1.0.0
* @see <a href=
* "https://stag-www.contentstack.com/docs/developers/apis/content-management-api/#merge-branches">Merge
* "https://www.contentstack.com/docs/developers/apis/content-management-api/#merge-branches">Merge
* Branches </a>
* @since 2023 -June-30
*/
Expand Down Expand Up @@ -128,7 +128,7 @@ public Call<ResponseBody> branch(@NotNull String compareBranch, JSONObject reque
*
* @return the call
* @see <a href=
* "https://stag-www.contentstack.com/docs/developers/apis/content-management-api/#get-all-merge-jobs"></a>Get
* "https://www.contentstack.com/docs/developers/apis/content-management-api/#get-all-merge-jobs"></a>Get
* all
* Merge Jobs
*/
Expand All @@ -144,7 +144,7 @@ public Call<ResponseBody> find() {
* @param mergeJobUid the key of the header to be added
* @return the call
* @see <a href=
* "https://stag-www.contentstack.com/docs/developers/apis/content-management-api/#get-single-merge-job"></a>Get
* "https://www.contentstack.com/docs/developers/apis/content-management-api/#get-single-merge-job"></a>Get
* a
* Single Merge Job
*/
Expand Down

0 comments on commit 6f95251

Please sign in to comment.