Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import javax.servlet.http.HttpSession;
import java.io.*;
import java.net.SocketException;
import java.net.URL;

/**
* This servlet requires a parameter called "source" which should signify where to get the image from. Examples include source=local_client, or source=hnr_client. Depending on the source, you may optionally need more parameters, as examples a local_client
Expand Down Expand Up @@ -315,7 +316,6 @@ private static void renderSignatureStored(HttpServletRequest request, HttpServle
}

private static void renderClinicLogoStored(HttpServletRequest request, HttpServletResponse response) throws IOException {

// sec check
HttpSession session = request.getSession();
Provider provider = (Provider) session.getAttribute(SessionConstants.LOGGED_IN_PROVIDER);
Expand All @@ -324,8 +324,18 @@ private static void renderClinicLogoStored(HttpServletRequest request, HttpServl
return;
}

// Get the default logo from the web resources
URL defaultResourceUrl = session.getServletContext()
.getResource("/WEB-INF/classes/loginResource/openosp_logo.png");
String defaultClinicLogo = (defaultResourceUrl != null) ? defaultResourceUrl.getPath() : null;

try {
String filename = OscarProperties.getInstance().getProperty("CLINIC_LOGO_FILE");
// Set the filename from properties or use the default logo
String filename = OscarProperties.getInstance().getProperty("CLINIC_LOGO_FILE", defaultClinicLogo);
if (filename == null || filename.isEmpty()) {
filename = defaultClinicLogo;
}

if (filename != null) {
File f = new File(filename);
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
if (f != null && f.exists()) {
Expand Down
Loading