List of usage examples for com.liferay.portal.kernel.util FileUtil encodeSafeFileName
public static String encodeSafeFileName(String fileName)
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public void addDirectory(long companyId, long repositoryId, String dirName) throws PortalException, SystemException { String safeDirName = FileUtil.encodeSafeFileName(dirName); if (!safeDirName.equals(dirName)) { try {//from w w w .jav a 2 s . c o m _store.move(dirName, safeDirName); } catch (Exception e) { } } _store.addDirectory(companyId, repositoryId, safeDirName); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public void addFile(long companyId, long repositoryId, String fileName, byte[] bytes) throws PortalException, SystemException { String safeFileName = FileUtil.encodeSafeFileName(fileName); renameUnsafeFile(companyId, repositoryId, fileName, safeFileName); _store.addFile(companyId, repositoryId, safeFileName, bytes); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public void addFile(long companyId, long repositoryId, String fileName, File file) throws PortalException, SystemException { String safeFileName = FileUtil.encodeSafeFileName(fileName); renameUnsafeFile(companyId, repositoryId, fileName, safeFileName); _store.addFile(companyId, repositoryId, safeFileName, file); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public void addFile(long companyId, long repositoryId, String fileName, InputStream is) throws PortalException, SystemException { String safeFileName = FileUtil.encodeSafeFileName(fileName); renameUnsafeFile(companyId, repositoryId, fileName, safeFileName); _store.addFile(companyId, repositoryId, safeFileName, is); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public void copyFileVersion(long companyId, long repositoryId, String fileName, String fromVersionLabel, String toVersionLabel) throws PortalException, SystemException { String safeFileName = FileUtil.encodeSafeFileName(fileName); renameUnsafeFile(companyId, repositoryId, fileName, safeFileName); _store.copyFileVersion(companyId, repositoryId, safeFileName, fromVersionLabel, toVersionLabel); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public void deleteDirectory(long companyId, long repositoryId, String dirName) throws PortalException, SystemException { String safeDirName = FileUtil.encodeSafeFileName(dirName); if (!safeDirName.equals(dirName)) { try {//from ww w . j a v a2 s . c om _store.deleteDirectory(companyId, repositoryId, dirName); return; } catch (Exception e) { } } _store.deleteDirectory(companyId, repositoryId, safeDirName); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public void deleteFile(long companyId, long repositoryId, String fileName) throws PortalException, SystemException { String safeFileName = FileUtil.encodeSafeFileName(fileName); if (!safeFileName.equals(fileName) && _store.hasFile(companyId, repositoryId, fileName)) { _store.deleteFile(companyId, repositoryId, fileName); return;/*from w ww .j a v a2 s . c om*/ } _store.deleteFile(companyId, repositoryId, safeFileName); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public void deleteFile(long companyId, long repositoryId, String fileName, String versionLabel) throws PortalException, SystemException { String safeFileName = FileUtil.encodeSafeFileName(fileName); if (!safeFileName.equals(fileName) && _store.hasFile(companyId, repositoryId, fileName, versionLabel)) { _store.deleteFile(companyId, repositoryId, fileName, versionLabel); return;//from www . j a va 2 s.com } _store.deleteFile(companyId, repositoryId, safeFileName, versionLabel); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public File getFile(long companyId, long repositoryId, String fileName) throws PortalException, SystemException { String safeFileName = FileUtil.encodeSafeFileName(fileName); if (!safeFileName.equals(fileName) && _store.hasFile(companyId, repositoryId, fileName)) { return _store.getFile(companyId, repositoryId, fileName); }//from w w w. ja v a 2s . c o m return _store.getFile(companyId, repositoryId, safeFileName); }
From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java
License:Open Source License
public File getFile(long companyId, long repositoryId, String fileName, String versionLabel) throws PortalException, SystemException { String safeFileName = FileUtil.encodeSafeFileName(fileName); if (!safeFileName.equals(fileName) && _store.hasFile(companyId, repositoryId, fileName, versionLabel)) { return _store.getFile(companyId, repositoryId, fileName, versionLabel); }//www .java 2 s . c o m return _store.getFile(companyId, repositoryId, safeFileName, versionLabel); }