mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-15 13:02:19 +00:00
Fixed a bug in the auto-overwrite of bundled plugins.
Bundled plugins should be laid down as *.jpi, with proper measure to migrate existing bits.
This commit is contained in:
1 parent
79e6d15728
commit
ba71264b6b
2 files changed
+13
-2
No files matched your search
@@ -396,10 +396,19 @@ public abstract class PluginManager extends AbstractModelObject {
|
||||
* with a reasonable up-to-date check. A convenience method to be used by the {@link #loadBundledPlugins()}.
|
||||
*/
|
||||
protected void copyBundledPlugin(URL src, String fileName) throws IOException {
|
||||
fileName = fileName.replace(".hpi",".jpi"); // normalize fileNames to have the correct suffix
|
||||
String legacyName = fileName.replace(".jpi",".hpi");
|
||||
long lastModified = src.openConnection().getLastModified();
|
||||
File file = new File(rootDir, fileName);
|
||||
File pinFile = new File(rootDir, fileName+".pinned");
|
||||
|
||||
{// normalization first
|
||||
File legacyFile = new File(rootDir,legacyName);
|
||||
if (legacyFile.exists()) legacyFile.renameTo(file);
|
||||
File legacyPinFile = new File(rootDir,legacyName+".pinned");
|
||||
if (legacyPinFile.exists()) legacyPinFile.renameTo(pinFile);
|
||||
}
|
||||
|
||||
// update file if:
|
||||
// - no file exists today
|
||||
// - bundled version and current version differs (by timestamp), and the file isn't pinned.
|
||||
|
||||
Reference in new issue
Block a user